Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_temp.pl

Rating
3 votes
Favoured:
0
Current Version
1.2
Last Release Date
2011-05-18
Compatible With
  • Nagios 2.x
  • Nagios 3.x
License
GPL
Hits
103341
Files:
FileDescription
check_temp.plVersion 1.2 of the perl script (warn fix)
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
A perl script that checks the CPU (or M/B) temperature with lm-sensors.
Default is to check the CPU temperature but this can be changed to check any temperature returned by sensors with an argument.
The plugin complies with the guidelines, for example uses -w -c -v arguments etc. It also does some basic sanity checks and has an exit 3 catchall.
###############################################
# To get the Temps from each core one per line:
# Be sure to edit /etc/nagios/objects/commands.cfg and change notify-service-by-email to this:
# command_line /usr/bin/printf "%b" "***** Nagios *****nnNotification Type: $NOTIFICATIONTYPE$nnService: $SERVICEDESC$nHost: $HOSTALIAS$nAddress: $HOSTADDRESS$nState: $SERVICESTATE$nnDate/Time: $LONGDATETIME$nnAdditional Info:nn$SERVICEOUTPUT$n$LONGSERVICEOUTPUT$n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
# notice the addition of $LONGSERVICEOUTPUT$n to the end of the message.
###############################################
This plugin can be used with NRPE or on a local machine.
It has been tested with sensor output in several forms:
#{1,3}
#{1,3}.#
#{1,3}.##

It will also match $sensor[newline]$temp where $sensor is the value of the -s argument.

## NRPE example ##
/etc/nagios/nrpe.cfg
command[check_temp]=/usr/lib/nagios/plugins/check_temp.pl -c 85 -w 75 -s 'CPU ., Core .'

/etc/sensors.conf
chip "coretemp-isa-0000"
label temp1 "CPU 0, Core 0"

chip "coretemp-isa-0001"
label temp1 "CPU 0, Core 1"

chip "coretemp-isa-0002"
label temp1 "CPU 0, Core 2"

chip "coretemp-isa-0003"
label temp1 "CPU 0, Core 3"

chip "coretemp-isa-0004"
label temp1 "CPU 1, Core 0"

chip "coretemp-isa-0005"
label temp1 "CPU 1, Core 1"

chip "coretemp-isa-0006"
label temp1 "CPU 1, Core 2"

chip "coretemp-isa-0007"
label temp1 "CPU 1, Core 3"


## Local config example ##
/etc/nagios/objects/commands.cfg
define command {
command_name check_temp
command_line $USER1$/check_temp.pl -w $ARG1$ -c $ARG2$ -s $ARG3$
}

/etc/nagios/objects/localhost.cfg
define service{
use local-service
host_name localhost
service_description CPU Temp
check_command check_temp!75!85!"CPU ., Core ."
}
Reviews (1)
bysnord, May 21, 2012
Works great using coretemp module on IBM xSeries servers. It would be perfect if it would support performance data output for graphing temperature trends. Maybe in a future update. Thanks.
Owner's reply

I will look into that. I have never done trend data before, so it would be something new to learn.