This article will walk you through the steps to set up environmental monitoring sensor inside the datacenter to monitor temperature and humidity with Nagios.
Buy and Set Up Sensor
First you need to buy an environmental monitoring sensor from the eesensor and they ship it as quickly as possible. You will need to setup the sensor with a static IP address when you have it in hand. Also in the package box you will find an instruction manual of how to configure it. After you have the sensor setup with static IP address of your network, you will be able to login to the device by accessing the IP address on any of your favorite web browser.
This would be first screen you will see after login into the sensor.
Configure Nagios
First you need to download the nagios plugin from this URL and extract it in your nagios server. Copy the check_em01.pl to your Nagios plugin directory /usr/local/nagios/libexec and make the file executable using the chmod x+ check_em01.pl command. There is also a Perl folder, inside the downloaded directory of nagios plugin and in that folder you will find checkcommands.cfg file. Edit it with any of your favorite editor and copy its contents to your Nagios commands.cfg file as show below.
# 'check_temp' command definition
define command{
command_name check_temp
command_line $USER1$/check_em01.pl --type=temp --temp=$ARG1$,$ARG2$ $HOSTADDRESS$
}
# 'check_humidity' command definition
define command{
command_name check_humidity
command_line $USER1$/check_em01.pl --type=hum --hum=$ARG1$,$ARG2$ $HOSTADDRESS$
}
Now setup the
# 'check_light command definition
define command{
command_name check_light
command_line $USER1$/check_em01.pl --type=illum --illum=$ARG1$,$ARG2$ $HOSTADDRESS$
}
Now setup the host and check up services. It will be look similar to like below:
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
}
Now reload Nagios with sudo service nagios reload command to update changes. The sensor should show up in your Nagios Dashboard as shown in image below.
Completed.