|
@@ -44,19 +44,21 @@ case "$1" in
|
|
|
*)
|
|
*)
|
|
|
sensordata=$(sensors 2>&1)
|
|
sensordata=$(sensors 2>&1)
|
|
|
status=$?
|
|
status=$?
|
|
|
- if [ "$status" == 127 ] ; then
|
|
|
|
|
|
|
+ if [ $status -eq 127 ] ; then
|
|
|
text="SENSORS UNKNOWN - command not found (did you install lmsensors?)"
|
|
text="SENSORS UNKNOWN - command not found (did you install lmsensors?)"
|
|
|
exit=$STATE_UNKNOWN
|
|
exit=$STATE_UNKNOWN
|
|
|
elif [ "$status" != 0 ] ; then
|
|
elif [ "$status" != 0 ] ; then
|
|
|
text="WARNING - sensors returned state $status"
|
|
text="WARNING - sensors returned state $status"
|
|
|
exit=$STATE_WARNING
|
|
exit=$STATE_WARNING
|
|
|
- elif [ "$(echo "${sensordata}" | egrep ALARM > /dev/null)" ] ; then
|
|
|
|
|
|
|
+ elif echo "${sensordata}" | egrep -q ALARM > /dev/null ; then
|
|
|
text="SENSOR CRITICAL - Sensor alarm detected!"
|
|
text="SENSOR CRITICAL - Sensor alarm detected!"
|
|
|
exit=$STATE_CRITICAL
|
|
exit=$STATE_CRITICAL
|
|
|
- elif [ \( "$(echo "${sensordata}" | egrep FAULT > /dev/null)" \) -a\
|
|
|
|
|
- \( "$(test "$1")" != "-i" -a "$1" != "--ignore-fault" \) ] ; then
|
|
|
|
|
- text="SENSOR UNKNOWN - Sensor reported fault"
|
|
|
|
|
- exit=$STATE_UNKNOWN
|
|
|
|
|
|
|
+ elif echo "${sensordata}" | egrep -q FAULT > /dev/null -a; then
|
|
|
|
|
+ if [ "$(test "$1")" != "-i" -a \
|
|
|
|
|
+ "$1" != "--ignore-fault" ] ; then
|
|
|
|
|
+ text="SENSOR UNKNOWN - Sensor reported fault"
|
|
|
|
|
+ exit=$STATE_UNKNOWN
|
|
|
|
|
+ fi
|
|
|
else
|
|
else
|
|
|
text="SENSORS OK"
|
|
text="SENSORS OK"
|
|
|
exit=$STATE_OK
|
|
exit=$STATE_OK
|