drop.chapril.org-tools/monitoring/check_dropchaprilorg_update

27 lines
629 B
Plaintext
Raw Normal View History

#!/bin/bash
#
# Nagios plugin to check Firefox Send version
#
LAST_VERSION=$(curl --silent https://api.github.com/repos/mozilla/send/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