summaryrefslogtreecommitdiffstats
path: root/plugins-scripts
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2011-09-07 12:04:01 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2011-09-07 12:04:01 (GMT)
commit5532dbe48a485edb7f75c5058a2aac87090f66d3 (patch)
tree8e4c5c93fa2b4d8a2787b1595bbb34529ae891c5 /plugins-scripts
parentf720f4a3c002c939858afe6bdcdf4bc08929652b (diff)
downloadmonitoring-plugins-5532dbe48a485edb7f75c5058a2aac87090f66d3.tar.gz
check_sensors: Use symbolic exit codes
Specify the exit codes by using the constants from utils.sh.
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-xplugins-scripts/check_sensors.sh20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
index 660b721..ffaa974 100755
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -21,25 +21,25 @@ print_help() {
21 echo "This plugin checks hardware status using the lm_sensors package." 21 echo "This plugin checks hardware status using the lm_sensors package."
22 echo "" 22 echo ""
23 support 23 support
24 exit 0 24 exit $STATE_OK
25} 25}
26 26
27case "$1" in 27case "$1" in
28 --help) 28 --help)
29 print_help 29 print_help
30 exit 0 30 exit $STATE_OK
31 ;; 31 ;;
32 -h) 32 -h)
33 print_help 33 print_help
34 exit 0 34 exit $STATE_OK
35 ;; 35 ;;
36 --version) 36 --version)
37 print_revision $PROGNAME $REVISION 37 print_revision $PROGNAME $REVISION
38 exit 0 38 exit $STATE_OK
39 ;; 39 ;;
40 -V) 40 -V)
41 print_revision $PROGNAME $REVISION 41 print_revision $PROGNAME $REVISION
42 exit 0 42 exit $STATE_OK
43 ;; 43 ;;
44 *) 44 *)
45 sensordata=`sensors 2>&1` 45 sensordata=`sensors 2>&1`
@@ -49,20 +49,20 @@ case "$1" in
49 fi 49 fi
50 if test ${status} -eq 127; then 50 if test ${status} -eq 127; then
51 echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)" 51 echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
52 exit -1 52 exit $STATE_UNKNOWN
53 elif test ${status} -ne 0; then 53 elif test ${status} -ne 0; then
54 echo "WARNING - sensors returned state $status" 54 echo "WARNING - sensors returned state $status"
55 exit 1 55 exit $STATE_WARNING
56 fi 56 fi
57 if echo ${sensordata} | egrep ALARM > /dev/null; then 57 if echo ${sensordata} | egrep ALARM > /dev/null; then
58 echo SENSOR CRITICAL - Sensor alarm detected! 58 echo SENSOR CRITICAL - Sensor alarm detected!
59 exit 2 59 exit $STATE_CRITICAL
60 elif echo ${sensordata} | egrep FAULT > /dev/null \ 60 elif echo ${sensordata} | egrep FAULT > /dev/null \
61 && test "$1" != "-i" -a "$1" != "--ignore-fault"; then 61 && test "$1" != "-i" -a "$1" != "--ignore-fault"; then
62 echo SENSOR UNKNOWN - Sensor reported fault 62 echo SENSOR UNKNOWN - Sensor reported fault
63 exit 3 63 exit $STATE_UNKNOWN
64 fi 64 fi
65 echo sensor ok 65 echo sensor ok
66 exit 0 66 exit $STATE_OK
67 ;; 67 ;;
68esac 68esac