summaryrefslogtreecommitdiff
path: root/sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2015-04-14 14:03:12 +0200
committerLeif Johansson <leifj@sunet.se>2015-04-14 14:03:12 +0200
commit954e401e3729f9db70386e4e95d56b7d655be0e4 (patch)
tree08b1325a0d3d6421edc0b720b8d200e4b326d98b /sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot
parentc27fcd33e1ba94220264dc56dc7606aa680e750c (diff)
parenta8a6b9476a886a707d5f9193cec503effc414969 (diff)
Merge branch 'master' of git.nordu.net:sunet-opssunet-ops-2015-04-14-v23
Diffstat (limited to 'sto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot')
-rwxr-xr-xsto-tug-kvm2.swamid.se/overlay/usr/lib/nagios/plugins/check_reboot37
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;
+