add monitoring script to check that kanboard is up to date
This commit is contained in:
parent
324fdbd3fa
commit
a82c9aeaf8
38
monitoring/check_kanbanchaprilorg_update
Executable file
38
monitoring/check_kanbanchaprilorg_update
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Nagios plugin to check kanboard version.
|
||||||
|
#
|
||||||
|
|
||||||
|
# program return value
|
||||||
|
# 0 : ok
|
||||||
|
# 1 : new version available
|
||||||
|
# 2 : error
|
||||||
|
# 3 : github not reachable
|
||||||
|
# 4 : no installed version find
|
||||||
|
|
||||||
|
LAST_VERSION=$(curl --silent https://api.github.com/repos/kanboard/kanboard/tags | jq -r '.[0].name')
|
||||||
|
|
||||||
|
file_name="/srv/kanban.chapril.org/www/app/constants.php"
|
||||||
|
INSTALLED_VERSION=$(cat $file_name |grep "^defined('APP_VERSION') or define('APP_VERSION', getenv('APP_VERSION') ?: build_app_version('" | grep -o "v[0-9]\.[0-9]\.[0-9][0-9]")
|
||||||
|
|
||||||
|
if [ -z "$LAST_VERSION" ]; then
|
||||||
|
echo "WARNING : cannot get version from github."
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$INSTALLED_VERSION" ]; then
|
||||||
|
echo "WARNING : cannot find installed version."
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$LAST_VERSION" = "$INSTALLED_VERSION" ]; then
|
||||||
|
echo "OK"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "WARNING : new version available, installed is $INSTALLED_VERSION, last is $LAST_VERSION."
|
||||||
|
#call api create tickets
|
||||||
|
echo 'version='$LAST_VERSION > /srv/kanban.chapril.org/tools/last-version.txt
|
||||||
|
/bin/bash /srv/kanban.chapril.org/tools/update.sh
|
||||||
|
#call api if good close tickets
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user