summaryrefslogtreecommitdiffstats
path: root/plugins-scripts
diff options
context:
space:
mode:
authorMatthias Eble <psychotrahe@users.sourceforge.net>2012-04-10 20:49:24 (GMT)
committerMatthias Eble <psychotrahe@users.sourceforge.net>2012-04-10 20:49:24 (GMT)
commit4c30935850997f513b3eee21d169f6d523d43c5d (patch)
tree09a14dfecd959e1b566b9df7b7fdb99f6bb4c5d8 /plugins-scripts
parent9978b3ca744b076d8ea24441819826938211dd17 (diff)
parent8c7e2b636c601dd05a6881c84cc95136ecf9323e (diff)
downloadmonitoring-plugins-4c30935850997f513b3eee21d169f6d523d43c5d.tar.gz
Merge branch 'master' of ssh://nagiosplug.git.sourceforge.net/gitroot/nagiosplug/nagiosplug
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