diff options
author | Johan Lundberg <lundberg@nordu.net> | 2015-04-14 13:49:06 +0200 |
---|---|---|
committer | Johan Lundberg <lundberg@nordu.net> | 2015-04-14 13:49:06 +0200 |
commit | 76167d46f33e918ee3848e2b9364a0707ba532e8 (patch) | |
tree | 2bdcb426e5931114c3c2bab95b304730de7e12c8 /sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot | |
parent | 11c3de86e97aacdc8a33b8fe21484c105a9f5988 (diff) |
Added nrpe configuration for sto-tug-kvm2
Diffstat (limited to 'sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot')
-rwxr-xr-x | sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot b/sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot new file mode 100755 index 0000000..4cb9df3 --- /dev/null +++ b/sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot @@ -0,0 +1,37 @@ +#!/bin/bash +declare -rx PROGNAME=${0##*/} +declare -rx PROGPATH=${0%/*}/ + +function cleanup { + #if [ -e "$TMPFILE" ] ; then + #rm "$TMPFILE" + #fi + exit $1 +} + +if [ -r "${PROGPATH}utils.sh" ] ; then + source "${PROGPATH}utils.sh" +else + echo "Can't find utils.sh." + printf "Currently being run from %s\n" "$PROGPATH" + # since we couldn't define STATE_UNKNOWN since reading utils.sh failed, we use 3 here but everywhere else after this use cleanup $STATE + cleanup 3 +fi + +STATE=$STATE_UNKNOWN + + +if [ -f /var/run/reboot-required.pkgs ] +then + pkg=`cat /var/run/reboot-required.pkgs` +fi + +if [ -f /var/run/reboot-required ] +then + echo "Reboot WARNING: System reboot required by package $pkg" + cleanup $STATE_WARNING; +fi + echo "Reboot OK: No reboot required" + cleanup $STATE_OK; +cleanup $STATE; + |