Not picking up solaris systems correctly for check_dhcp. Only
[monitoring-plugins.git] / plugins-scripts / check_sensors.sh
blob7e1d3333b7d2fe3187075b2644a0d115612aeadc
1 #!/bin/sh
3 PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
5 PROGNAME=`basename $0`
6 PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
7 REVISION=`echo '$Revision$' | sed -e 's/[^0-9.]//g'`
9 . $PROGPATH/utils.sh
12 print_usage() {
13 echo "Usage: $PROGNAME"
16 print_help() {
17 print_revision $PROGNAME $REVISION
18 echo ""
19 print_usage
20 echo ""
21 echo "This plugin checks hardware status using the lm_sensors package."
22 echo ""
23 support
24 exit 0
27 case "$1" in
28 --help)
29 print_help
30 exit 0
32 -h)
33 print_help
34 exit 0
36 --version)
37 print_revision $PROGNAME $REVISION
38 exit 0
40 -V)
41 print_revision $PROGNAME $REVISION
42 exit 0
45 sensordata=`sensors 2>&1`
46 status=$?
47 if test "$1" = "-v" -o "$1" = "--verbose"; then
48 echo ${sensordata}
50 if test ${status} -eq 127; then
51 echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
52 exit -1
53 elif test ${status} -ne 0 ; then
54 echo "WARNING - sensors returned state $status"
55 exit 1
57 if echo ${sensordata} | egrep ALARM > /dev/null; then
58 echo SENSOR CRITICAL - Sensor alarm detected!
59 exit 2
60 else
61 echo sensor ok
62 exit 0
65 esac