From acd2f5badb50a562eec3ce1a366799a47dcc61d4 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Wed, 3 Feb 2010 11:10:29 +0000 Subject: Add three Nagios checks to detect bugs in /etc/resolv.conf, /etc/hosts and a shutdown in progress. --- nagios-plugins/check_shutdown | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 nagios-plugins/check_shutdown (limited to 'nagios-plugins/check_shutdown') diff --git a/nagios-plugins/check_shutdown b/nagios-plugins/check_shutdown new file mode 100755 index 0000000..756e6fb --- /dev/null +++ b/nagios-plugins/check_shutdown @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Report when a reboot is in progress. Useful to detect if +# reboot-when-idle have been used on a server. + +set -e + +PATH=/bin:/sbin:/usr/sbin:/usr/bin:/local/bin:/local/sbin + +shutdownpid="`pgrep '^shutdown$'|head -1`" + +if [ "$shutdownpid" ] ; then + case "`uname -s`" in + Linux) + cmd="`ps --no-headers --pid $shutdownpid -o command`" + echo "REBOOT IN PROGRESS: $cmd" + ;; + *) + echo "REBOOT IN PROGRESS" + ;; + esac + exit 1 +fi + +echo "OK - no shutdown running" +exit 0 -- cgit v1.2.3