From f30d708cbc843c34e9a61c819cec5bbf391cd83d Mon Sep 17 00:00:00 2001 From: Romain H Date: Wed, 1 Apr 2020 16:20:00 +0200 Subject: [PATCH] add montoring script to check that Firefox Send is up to date --- monitoring/check_dropchaprilorg_update | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 monitoring/check_dropchaprilorg_update diff --git a/monitoring/check_dropchaprilorg_update b/monitoring/check_dropchaprilorg_update new file mode 100755 index 0000000..9e582b0 --- /dev/null +++ b/monitoring/check_dropchaprilorg_update @@ -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 +