drop.chapril.org-tools/monitoring/check_dropchaprilorg_update

27 lines
642 B
Bash
Executable File

#!/bin/bash
#
# Nagios plugin to check Firefox Send version
#
LAST_VERSION=$(curl --silent https://gitlab.com/api/v4/projects/21505091/repository/tags | jq -r '.[0].name')
INSTALLED_VERSION=$(jq -r '.version' /srv/drop/www/package.json)
if [ -z "$LAST_VERSION" ]; then
echo "WARNING : cannot get version from github."
exit 1
fi
if [ -z "$INSTALLED_VERSION" ]; then
echo "WARNING : cannot find installed version."
exit 1
fi
if [ "$LAST_VERSION" == "v$INSTALLED_VERSION" ]; then
echo "OK"
exit 0
else
echo "WARNING : new version available, installed is $INSTALLED_VERSION, last is $LAST_VERSION."
exit 1
fi