~ubuntu-branches/ubuntu/trusty/nagios-plugins/trusty-proposed

« back to all changes in this revision

Viewing changes to plugins-scripts/check_sensors.sh

  • Committer: Package Import Robot
  • Author(s): Yolanda Robla
  • Date: 2013-12-11 10:09:01 UTC
  • mfrom: (12.2.22 sid)
  • Revision ID: package-import@ubuntu.com-20131211100901-g0kqwx300l24be53
Tags: 1.5-1ubuntu1
* Merge from Debian unstable (LP: #1259863).  Remaining changes:
  - debian/control, debian/rules, debian/nagios-plugins-extra.dirs
     + add package nagios-plugins-extra
     + Suggest nagios-plugins-contrib in the universe package (-extras).
  - debian/control
     - replaces on nagios-plugins-basic (<< 1.4.16-1ubuntu1)
     - conflicts and replaces on nagios-plugins-extra

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
        *)
45
45
                sensordata=`sensors 2>&1`
46
46
                status=$?
47
 
                if test "$1" = "-v" -o "$1" = "--verbose"; then
48
 
                        echo ${sensordata}
49
 
                fi
50
47
                if test ${status} -eq 127; then
51
 
                        echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
52
 
                        exit $STATE_UNKNOWN
 
48
                        text="SENSORS UNKNOWN - command not found (did you install lmsensors?)"
 
49
                        exit=$STATE_UNKNOWN
53
50
                elif test ${status} -ne 0; then
54
 
                        echo "WARNING - sensors returned state $status"
55
 
                        exit $STATE_WARNING
56
 
                fi
57
 
                if echo ${sensordata} | egrep ALARM > /dev/null; then
58
 
                        echo SENSOR CRITICAL - Sensor alarm detected!
59
 
                        exit $STATE_CRITICAL
 
51
                        text="WARNING - sensors returned state $status"
 
52
                        exit=$STATE_WARNING
 
53
                elif echo ${sensordata} | egrep ALARM > /dev/null; then
 
54
                        text="SENSOR CRITICAL - Sensor alarm detected!"
 
55
                        exit=$STATE_CRITICAL
60
56
                elif echo ${sensordata} | egrep FAULT > /dev/null \
61
57
                    && test "$1" != "-i" -a "$1" != "--ignore-fault"; then
62
 
                        echo SENSOR UNKNOWN - Sensor reported fault
63
 
                        exit $STATE_UNKNOWN
64
 
                fi
65
 
                echo sensor ok
66
 
                exit $STATE_OK
 
58
                        text="SENSOR UNKNOWN - Sensor reported fault"
 
59
                        exit=$STATE_UNKNOWN
 
60
                else
 
61
                        text="SENSORS OK"
 
62
                        exit=$STATE_OK
 
63
                fi
 
64
 
 
65
                echo "$text"
 
66
                if test "$1" = "-v" -o "$1" = "--verbose"; then
 
67
                        echo ${sensordata}
 
68
                fi
 
69
                exit $exit
67
70
                ;;
68
71
esac