/[svn.andrew.net.au]/scripts/check_temperature
ViewVC logotype

Annotation of /scripts/check_temperature

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (hide annotations)
Sun May 27 19:34:48 2007 UTC (14 years, 4 months ago) by apollock
File size: 800 byte(s)
Differentiate output based on state

1 apollock 20 #!/bin/bash
2    
3     READ_TEMPERATURE="/usr/local/bin/read-temperature.py"
4    
5     if [ -r /usr/lib/nagios/plugins/utils.sh ]; then
6     source /usr/lib/nagios/plugins/utils.sh
7     else
8     echo "Please install nagios-plugins-text"
9     exit
10     fi
11    
12     if [ ! -x $READ_TEMPERATURE ]; then
13     echo "Can't find read-temperature.py"
14     exit $STATE_UNKNOWN
15     fi
16    
17     if [ $(echo $@ | wc -w) -ne 2 ]; then
18     echo "Usage: $(basename $0) warn_temp crit_temp"
19     exit $STATE_UNKNOWN
20     fi
21    
22     WARN_TEMP=$1
23     CRIT_TEMP=$2
24    
25     TEMPERATURE=$($READ_TEMPERATURE --mrtg)
26    
27     if [ $TEMPERATURE -gt $CRIT_TEMP ]; then
28 apollock 21 $ECHO "CRITICAL: Temperature is $TEMPERATURE °C\n"
29 apollock 20 exit $STATE_CRITICAL
30     elif [ $TEMPERATURE -gt $WARN_TEMP ]; then
31 apollock 21 $ECHO "WARNING: Temperature is $TEMPERATURE °C\n"
32 apollock 20 exit $STATE_WARNING
33     else
34 apollock 21 $ECHO "OK: Temperature is $TEMPERATURE °C\n"
35 apollock 20 exit $STATE_OK
36     fi

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.22