Monitor server room temperature with Nagios

If you want to monitor the temperature and humidity level of your server room with Nagios then there is a plugin for that. I personally don’t go to the server room regularly so I wouldn’t know if the AC failed in that room until probably its too late, so getting automatic alerts when the room gets too hot or too cold is a good idea.  In this tutorial I will guide you step by step on how to setup a temperature sensor in your server room , and set Nagios to notify you when the temperature or humidity level is too high or too low in the room.

server room temperature

Setting up the sensor

The first thing you need to do is get the sensor. I bought our sensor from here we bought two, and both were shipped quickly, so they are fast!! You will need to setup the sensor with a static IP address when it arrives, in the package you will find detailed instructions how to do it, so getting it up and running is quick and simple. After you have the sensor setup with its own static IP address, you will be able to login to the device by typing in the IP address on the browser

Sensor web GUI

Setting up Nagios

Now, that the sensor is setup, its time to setup the Nagios plugin. Download the plugin from this URL and extract it. Upload the to your Nagios plugin directory /usr/local/nagios/libexec and using terminal make the file executable using this command  chmod x+  inside the folder you downloaded there is a Perl folder, inside that folder you will find this file checkcommands.cfg open it and copy and paste its contents to your Nagios commands.cfg file:

# 'check_temp' command definition
define command{
	command_name check_temp
	command_line $USER1$/ --type=temp --temp=$ARG1$,$ARG2$ $HOSTADDRESS$

# 'check_humidity' command definition
define command{
	command_name check_humidity
	command_line $USER1$/ --type=hum --hum=$ARG1$,$ARG2$ $HOSTADDRESS$
Now setup the 
# 'check_light command definition
define command{
	command_name check_light
	command_line $USER1$/ --type=illum --illum=$ARG1$,$ARG2$ $HOSTADDRESS$

Then setup the host and check up services. mine look like this:

define host{                                              
        use                     websensor-host            ; Name of host template to use
        host_name               websensor               
        alias                   websensor
        address                 192.168.x.x
                contact_groups                  admins ; 

define service{
        use                             websensor-service         ; Name of service template to use
        host_name                       websensor
        service_description             EM01 Websensor Temperature
        check_command           check_temperature!20!80!10!88

define service{
        use                                             websensor-service         ; Name of service template to use
        host_name                                       websensor
        service_description                            EM01 Websensor Humidity
        check_command                                   check_humidity!10!90!5!95

Reload Nagios sudo service nagios reload then after that, the sensor should show up in your Nagios Dashboard like this:


That’s it. you are done!

More Nagios Tutorials

about My name is Nelson Amaya and I’m the author of this website. I created the site in 2009 (under the domain) and I’ve been posting tutorials here ever since. I'm a systems / network administrator and I enjoy solving complex problems and learning as much as I can about new technologies. I write tutorials based on my work experience and other IT stuff I find interesting.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>