2020-04-01 16:20:00 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Nagios plugin to check Firefox Send version
|
|
|
|
#
|
|
|
|
|
2021-03-06 15:11:46 +01:00
|
|
|
LAST_VERSION=$(curl --silent https://gitlab.com/api/v4/projects/21505091/repository/tags | jq -r '.[0].name')
|
2020-04-01 16:20:00 +02:00
|
|
|
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
|
|
|
|
|