summaryrefslogtreecommitdiffstats
path: root/plugins-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-xplugins-scripts/check_sensors.sh31
1 files changed, 17 insertions, 14 deletions
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
index ae80fc4..ffaa974 100755
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -10,7 +10,7 @@ REVISION="@NP_VERSION@"
10 10
11 11
12print_usage() { 12print_usage() {
13 echo "Usage: $PROGNAME" 13 echo "Usage: $PROGNAME" [--ignore-fault]
14} 14}
15 15
16print_help() { 16print_help() {
@@ -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,17 +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 else 60 elif echo ${sensordata} | egrep FAULT > /dev/null \
61 echo sensor ok 61 && test "$1" != "-i" -a "$1" != "--ignore-fault"; then
62 exit 0 62 echo SENSOR UNKNOWN - Sensor reported fault
63 exit $STATE_UNKNOWN
63 fi 64 fi
65 echo sensor ok
66 exit $STATE_OK
64 ;; 67 ;;
65esac 68esac