11 Commits
v0.5 ... v0.7

Author SHA1 Message Date
e9c10b3f54 Fixed tabs/spaces in THANKS file and added URL to the BitBucket project 2012-12-06 05:05:10 +01:00
95a7d33142 Merged in elyrith/check_temp (pull request #3) 2012-12-01 03:09:30 +01:00
Elyrith
92a9b70125 Fixed line numbers mentioned in comments due to my comments pushing the code down 2012-11-30 00:29:22 -05:00
Elyrith
7e33e13abc Increased version to 0.7 because of new "advanced" sensor parsing (line 191)
-Added following line edits info to comments at the top and increased version number
-Line 193, modified sensor parsing to cut after the first '+' since all positive temperatures are preceded by a + and the one we want is labeled first
-Line 211, reduced "verbosity" needed to see verbose info (was 2: -v -v)
-Line 229-232, now checks if no sensor data was found and exits with STATE_UNKNOWN
-Fixed 2 typos, one in output and other an in-line comment
-Updated line numbers in previous version info lines in comments since my comments pushed the lines down
2012-11-30 00:08:45 -05:00
3223933494 Merged in elyrith/check_temp (pull request #2) 2012-11-30 00:55:10 +01:00
Elyrith
add8a481c7 Added myself to THANKS with permission from author. 2012-11-29 18:51:03 -05:00
37b8e9db82 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
2012-11-30 00:35:45 +01:00
Elyrith
e4228c22e5 A few typos and mentioning that is uses *nix 'sensors' 2012-11-29 17:56:54 -05:00
Elyrith
3c8ab0cdc2 Added PERFDATA to put Nagios Performance Data when viewing service details. 2012-11-29 17:18:40 -05:00
844218b7d5 Fixed a bug by escaping the -? option 2012-02-19 23:03:10 +01:00
dc66a71fce Updated README with known forks 2012-01-26 02:13:40 +01:00
3 changed files with 41 additions and 19 deletions

11
README
View File

@@ -1,10 +1,15 @@
check_temp check_temp
A small Nagios plugin that checks the CPU (or M/B) temperature with lm-sensors. 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. 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 Default is to check the CPU temperature but this can be changed to, for example,
the motherboard temperature with a "--sensor" argument. the motherboard temperature with a "--sensor" argument.
The plugin complies with the guidelines, for example uses -w -c -v arguments 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. 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
avalible on Nagios Exchange at
http://exchange.nagios.org/directory/Plugins/Operating-Systems/Linux/check_temp-2Epl/details

4
THANKS
View File

@@ -1,9 +1,9 @@
check_temp THANKS file check_temp THANKS file
check_temp was originally written by Jack-Benny Persson. 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. improvements or submitting code.
Here is a list of these kind people. Here is a list of these kind people.
Chad Columbus ccolumbu@hotmail.com Chad Columbus ccolumbu@hotmail.com
Ryan Loudfoot elyrith@gmail.com

View File

@@ -24,12 +24,21 @@
# # # #
# Nagios plugin to monitor CPU and M/B temperature with sensors. # # Nagios plugin to monitor CPU and M/B temperature with sensors. #
# Written in Bash (and uses sed & awk). # # Written in Bash (and uses sed & awk). #
# Version 0.2: Line 98, fixed the missing "-n" option (Thanks to Chad who # # Latest version of check_temp can be found at the below URL: #
# https://bitbucket.org/jackbenny/check_temp #
# #
# Version 0.2: Line 103, fixed the missing "-n" option (Thanks to Chad who #
# pointed this out for me). Also added a "shopt -s extglob". (Thx to Chad) # # pointed this out for me). Also added a "shopt -s extglob". (Thx to Chad) #
# Version 0.5: Line 162, fixed a typo (EXIT_UNKNOWN to STATE_UNKNOWN) # # Version 0.5: Line 168, fixed a typo (EXIT_UNKNOWN to STATE_UNKNOWN) #
# Version 0.7: #
# Line 193, modified sensor parsing to cut after the first '+' since all #
# positive temperatures are preceded by a '+' #
# Line 211, reduced "verbosity" needed to see verbose info (was 2: -v -v) #
# Line 229-232, now checks to see if no sensor data was found and #
# exits with STATE_UNKNOWN #
############################################################################### ###############################################################################
VERSION="Version 0.5" VERSION="Version 0.7"
AUTHOR="(c) 2011 Jack-Benny Persson (jack-benny@cyberinfo.se)" AUTHOR="(c) 2011 Jack-Benny Persson (jack-benny@cyberinfo.se)"
# Sensor program # Sensor program
@@ -56,7 +65,7 @@ print_help()
{ {
print_version print_version
printf "$AUTHOR\n" printf "$AUTHOR\n"
printf "Monitor temperatur with the use of sensors\n" printf "Monitor temperature with the use of sensors\n"
/bin/cat <<EOT /bin/cat <<EOT
Options: Options:
@@ -150,7 +159,7 @@ while [[ -n "$1" ]]; do
shift 2 shift 2
;; ;;
-?) -\?)
print_help print_help
exit $STATE_OK exit $STATE_OK
;; ;;
@@ -184,10 +193,10 @@ fi
#Get the temperature #Get the temperature
TEMP=`${SENSORPROG} | grep "$sensor Temp" | awk '{print $3}' | cut -c2-3` TEMP=`${SENSORPROG} | grep "$sensor" | cut -d+ -f2 | cut -c1-2 `
# Check if the tresholds has been set correctly # Check if the thresholds have been set correctly
if [[ -z "$thresh_warn" || -z "$thresh_crit" ]]; then if [[ -z "$thresh_warn" || -z "$thresh_crit" ]]; then
# One or both thresholds were not specified # One or both thresholds were not specified
printf "\nThreshold not set" printf "\nThreshold not set"
@@ -202,7 +211,7 @@ fi
# Verbose output # Verbose output
if [[ "$verbosity" -ge 2 ]]; then if [[ "$verbosity" -ge 1 ]]; then
/bin/cat <<__EOT /bin/cat <<__EOT
Debugging information: Debugging information:
Warning threshold: $thresh_warn Warning threshold: $thresh_warn
@@ -211,25 +220,33 @@ Debugging information:
Current $sensor temperature: $TEMP Current $sensor temperature: $TEMP
__EOT __EOT
printf "\n Temperature lines directly from sensors:\n" printf "\n Temperature lines directly from sensors:\n"
${SENSORPROG} | grep "Temp" ${SENSORPROG}
printf "\n\n" printf "\n\n"
fi fi
# Get performance data for Nagios "Performance Data" field
PERFDATA=`${SENSORPROG} | grep "$sensor"`
# And finally check the temperature against our thresholds # And finally check the temperature against our thresholds
if [[ "$TEMP" -gt "$thresh_crit" ]]; then if [[ "$TEMP" != +([0-9]) ]]; then
# Temperature not found for that sensor
printf "No data found for that sensor ($sensor)\n"
exit $STATE_UNKNOWN
elif [[ "$TEMP" -gt "$thresh_crit" ]]; then
# Temperature is above critical threshold # Temperature is above critical threshold
echo "$sensor CRITICAL - Temperature is $TEMP" echo "$sensor CRITICAL - Temperature is $TEMP | $PERFDATA"
exit $STATE_CRITICAL exit $STATE_CRITICAL
elif [[ "$TEMP" -gt "$thresh_warn" ]]; then elif [[ "$TEMP" -gt "$thresh_warn" ]]; then
# Temperature is above warning threshold # Temperature is above warning threshold
echo "$sensor WARNING - Temperature is $TEMP" echo "$sensor WARNING - Temperature is $TEMP | $PERFDATA"
exit $STATE_WARNING exit $STATE_WARNING
else else
# Temperature is ok # Temperature is ok
echo "$sensor OK - Temperature is $TEMP" echo "$sensor OK - Temperature is $TEMP | $PERFDATA"
exit $STATE_OK exit $STATE_OK
fi fi
exit 3 exit 3