[nagiosplug] check_sensors: Detect FAULT status

Holger Weiss hweiss at users.sourceforge.net
Wed Sep 7 13:58:54 CEST 2011


 Module: nagiosplug
 Branch: master
 Commit: 276c5b98bf619eabd8b0bd5fc3ff60c0a59489a7
 Author: Holger Weiss <holger at zedat.fu-berlin.de>
   Date: Wed Sep  7 13:55:53 2011 +0200
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=276c5b9

check_sensors: Detect FAULT status

Return an UNKNOWN status if a faulty sensor is detected.  This can be
suppressed with the new "--ignore-fault" option.

(Fixes Debian bug #615133, patch suggested by Jan Wagner.)

---

 NEWS                             |    1 +
 plugins-scripts/check_sensors.sh |   11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index fd9b8e8..a9f70c1 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ This file documents the major additions and syntax changes between releases.
 	check_http now checks for and prints the certificate cn (hostname) in SSL certificate checks (Stéphane Urbanovski)
 	Add perfdata to check_ssh (#3244097 - Marco Beck)
 	New option to check_smtp to ignore failures when sending QUIT (#3358348 - Duncan Ferguson)
+	check_sensors now detects faulty sensors unless --ignore-fault is specified (Jan Wagner)
 
 	FIXES
 	Fix check_disk free space calculation if blocksizes differ within a disk group (Bekar - #2973603)
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
index ae80fc4..d108bcc 100755
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -10,7 +10,7 @@ REVISION="@NP_VERSION@"
 
 
 print_usage() {
-	echo "Usage: $PROGNAME"
+	echo "Usage: $PROGNAME" [--ignore-fault]
 }
 
 print_help() {
@@ -57,9 +57,12 @@ case "$1" in
 		if echo ${sensordata} | egrep ALARM > /dev/null; then
 			echo SENSOR CRITICAL - Sensor alarm detected!
 			exit 2
-		else
-			echo sensor ok
-			exit 0
+		elif echo ${sensordata} | egrep FAULT > /dev/null \
+		    && test "$1" != "-i" -a "$1" != "--ignore-fault"; then
+			echo SENSOR UNKNOWN - Sensor reported fault
+			exit 3
 		fi
+		echo sensor ok
+		exit 0
 		;;
 esac





More information about the Commits mailing list