add montoring script to check that Firefox Send is up to date

This commit is contained in:
Romain H 2020-04-01 16:20:00 +02:00
parent b42764aa4e
commit f30d708cbc
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
#!/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