File nagios-plugins-enhance_check_sensors.patch of Package nagios-plugins

If you look closely at what check_sensors is doing, it has a
not-so-sophisticated series of "if" statements that tries to hit a proper case
as reported by runnings the "sensors(1)" command.  

But it's missing a very important conditional. The script presumes that a
non-error condition will return an RC of 0, and that all error cases will
return an RC > 0.  The important case that is missed is that 0 is returned if
the kernel module isn't loaded.

  "Craig Gardner" <cgardner@suse.com>

Index: plugins-scripts/check_sensors.sh
===================================================================
--- plugins-scripts/check_sensors.sh.orig
+++ plugins-scripts/check_sensors.sh
@@ -50,6 +50,9 @@ case "$1" in
 		if test ${status} -eq 127; then
 			echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
 			exit -1
+        elif echo ${sensordata} | egrep "No sensors found" > /dev/null; then
+            echo "SENSORS UNKNOWN - no sensor monitor detected (is the kernel module loaded?)"
+            exit -2
 		elif test ${status} -ne 0 ; then
 			echo "WARNING - sensors returned state $status"
 			exit 1
openSUSE Build Service is sponsored by