Merged in elyrith/check_temp (pull request #1)

A few typos and mentioning that is uses *nix 'sensors'
Added PERFDATA to put Nagios Performance Data when viewing service details
This commit is contained in:
Jack-Benny Persson 2012-11-30 00:35:45 +01:00
commit 37b8e9db82
3 changed files with 10 additions and 7 deletions

6
README
View File

@ -1,13 +1,13 @@
check_temp
A small Nagios plugin that checks the CPU (or M/B) temperature with lm-sensors.
It's written in Bash and uses some sed & awk.
Default is to check the CPU temperature but this can be changed to for example
It's written in Bash and uses *nix "sensors" and some sed & awk.
Default is to check the CPU temperature but this can be changed to, for example,
the motherboard temperature with a "--sensor" argument.
The plugin complies with the guidelines, for example uses -w -c -v arguments
etc. It also does some basic sanity checks and has a exit 3 catchall.
The plugin were submitted to Nagios Exchange in 2011.
The plugin was submitted to Nagios Exchange in 2011.
Known forks of check_temp:
There is a very good Perl fork of check_temp written by Chad Columbus. It's

2
THANKS
View File

@ -1,7 +1,7 @@
check_temp THANKS file
check_temp was originally written by Jack-Benny Persson.
Some kind people has been contributing by reporting problems, suggesting
Some kind people have been contributing by reporting problems, suggesting
improvements or submitting code.
Here is a list of these kind people.

View File

@ -215,21 +215,24 @@ ${SENSORPROG} | grep "Temp"
printf "\n\n"
fi
# Get performance data for Nagios "Performance Data" field
PERFDATA=`${SENSORPROG} | grep "$sensor"`
# And finally check the temperature against our thresholds
if [[ "$TEMP" -gt "$thresh_crit" ]]; then
# Temperature is above critical threshold
echo "$sensor CRITICAL - Temperature is $TEMP"
echo "$sensor CRITICAL - Temperature is $TEMP | $PERFDATA"
exit $STATE_CRITICAL
elif [[ "$TEMP" -gt "$thresh_warn" ]]; then
# Temperature is above warning threshold
echo "$sensor WARNING - Temperature is $TEMP"
echo "$sensor WARNING - Temperature is $TEMP | $PERFDATA"
exit $STATE_WARNING
else
# Temperature is ok
echo "$sensor OK - Temperature is $TEMP"
echo "$sensor OK - Temperature is $TEMP | $PERFDATA"
exit $STATE_OK
fi
exit 3