Icinga Verzeichnis umgebaut

This commit is contained in:
Patrick 2018-01-17 08:21:01 +01:00
parent d16fe7fbae
commit 1212e9395e
4 changed files with 169 additions and 0 deletions

35
checks/check_dokuwiki_update Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
version_website=$(lynx -dump https://www.dokuwiki.org/changes 2> /dev/null | grep ^Release | head -n 1 | cut -d " " -f 2)
if [ $# = 0 ]
then
dokuwiki_root="/var/www/"
else
dokuwiki_root=$1
fi
/usr/bin/which lynx > /dev/null 2>&1
if [ ! $? = 0 ]
then
echo "lynx ist nicht installiert"
exit 1
fi
installed_version=$(cut -d " " -f 1 "$dokuwiki_root"/VERSION)
#Versionspruefung
if [ "$installed_version" = "$version_website" ]
then
echo "DokuWiki ist up-to-date - installed version: $installed_version; newest version: $version_website"
exit 0
else
#Warnung wird ausgegeben
echo "different version - installed version: $installed_version; newest version: $version_website"
exit 1
fi

36
checks/check_gitea_update Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
if [ "$#" = 0 ]
then
app_root="/home/git/gitea/gitea"
else
app_root=$1
fi
/usr/bin/which lynx > /dev/null 2>&1
if [ ! $? = 0 ]
then
echo "lynx ist nicht installiert"
exit 1
fi
if [ -e "$app_root" ]
then
gitea_local_version=$($app_root --version | awk '{print $3}')
else
echo "$app_root does not exist. exit"
exit 1
fi
gitea_remote_version=$(lynx -dump https://github.com/go-gitea/gitea/releases | grep -B 2 GiteaBot | grep "]v" | grep -v rc | cut -d "v" -f 2 | head -n 1)
if [ "$gitea_local_version" = "$gitea_remote_version" ]
then
echo "gitea ist up-to-date - installed version: $gitea_local_version; newest version: $gitea_remote_version"
exit 0
else
#Warnung wird ausgegeben
echo "different version - installed version: $gitea_local_version; newest version: $gitea_remote_version"
exit 1
fi

59
checks/check_nextcloud_update Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
if [ "$#" = 0 ]
then
app_root="/var/www/"
else
app_root=$1
fi
/usr/bin/which lynx > /dev/null 2>&1
if [ ! $? = 0 ]
then
echo "lynx ist nicht installiert"
exit 1
fi
if [ -e "$app_root"/version.php ]
then
# echo "owncloud Version 6 oder hoeher erkannt"
version_full=$(grep OC_VersionString "$app_root"/version.php | cut -d "'" -f2)
else
echo "$app_root/version.php does not exist. exit"
exit 1
fi
#Versionspruefung
#echo version_full: $version_full
if [ "$version_full" = "8.0" ]
then
version_full="8.0.0"
fi
if [ "$version_full" = "10.0" ]
then
version_full="10.0.0"
fi
#echo nachbearbeitet version_full: $version_full
#Debugging-Schalter
#version_short=$(echo $version_full | cut -d "." -f1-2)
#echo version_short: $version_short
version_website=$(lynx -dump https://download.nextcloud.com/server/releases/ | grep "tar.bz2.sha512" | grep "]" | tail -n 1 | cut -d "]" -f 3 |awk '{print $1}' | cut -d "-" -f 2 | cut -d "." -f 1-3)
#echo version_website: $version_website
if [ "$version_full" = "$version_website" ]
then
echo "owncloud ist up-to-date - installed version: $version_full; newest version: $version_website"
exit 0
#elif [ $version_full -lt $version_website ]
# echo Version ist kleiner
else
#Warnung wird ausgegeben
echo "different version - installed version: $version_full; newest version: $version_website"
exit 1
fi

39
checks/check_owncloud_update Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
owncloud_root="/var/www/owncloud/"
if [ -e $owncloud_root/version.php ]
then
# echo "owncloud Version 6 oder hoeher erkannt"
version_full=$(grep OC_VersionString $owncloud_root/version.php | cut -d"'" -f2)
fi
#Versionspruefung
#echo version_full: $version_full
if [ "$version_full" = "8.0" ]
then
version_full="8.0.0"
fi
#echo nachbearbeitet version_full: $version_full
version_short=$(echo $version_full | cut -d "." -f1-2)
#echo version_short: $version_short
version_website=$(w3m -dump http://owncloud.org/changelog/ | egrep "(Version|Release) $version_short" | head -n 1 | cut -d " " -f 2)
#echo version_website: $version_website
if [ "$version_full" = "$version_website" ]
then
echo "owncloud ist up-to-date - installed version: $version_full; newest version: $version_website"
exit 0
#elif [ $version_full -lt $version_website ]
# echo Version ist kleiner
else
#Warnung wird ausgegeben
echo "different version - installed version: $version_full; newest version: $version_website"
exit 1
fi