In the construction of Altamer Resort's Datacenter, we choose a EM01 HVAC Monitor to monitor the temperature and humidity. As the room is in the Caribbean and has no ventilation, without airconditioning the computers would quickly overheat. As there is only one AC unit, we needed to ensure we were aware of any problems. The resort relies heavily on computers for reservations, point of sale, email, file storage, call accounting and music for the network music system so the objective was to design a heavily monitored installation with automatic recovery where possible..
Our Nagios monitoring system runs on a Redhat 9 rack mounted server and monitors all the servers and critical services. On the event of a problem and email is sent to the administrator, who is normally not on property, and using a Text Messaging gateway, a message is sent to his cellphone. Some services are auto-restarted by nagios over ssh after they have been declared hard down by the software, usually after three checks at one minute intervals.
MRTG is used to record the output of the sensors over time and chart them.
The
heating, ventilation, and air-conditioning (HVAC) monitor has three sensors:
temperature,
illumination, and relative humidity. We intended to use all three but only alarm
on temperature and humidity. Humidity was used as an airconditioned room should
have very lo humidity and so it would be a sign of a leak, door left open, roof
leak, flood etc.
The EM01 is a network based sensor. There were many low priced serial sensors but we were interested in being able to monitor remote locations in the future so network sensors were preferred. The network sensor is far easier to configure than a serial port sensor and is liable to be more reliable, in our opinion.
The sensor is assigned an IP and gateway IP using the ES00r provided in the kit. Only one ES00r is needed as it is only used in setup. The manual details the proceedure well so I won't go into it, but one warning is warranted. When you transfer the settings, a popup tells you to power cycle the unit. You should wait until all activity has ended before doing this, probably 15 seconds later.
For our first unit, I used 192.168.0.41 - all other sensors will be in the range 41-51. You should use the appropriate network settings for your network.
At this point you can attach the unit to the network and ping it.
# ping 192.168.0.41
PING 192.168.0.41 (192.168.0.41) from 192.168.0.2 : 56(84) bytes of data.
64 bytes from 192.168.0.41: icmp_seq=0 ttl=64 time=2.614 msec
64 bytes from 192.168.0.41: icmp_seq=1 ttl=64 time=2.561 msec
64 bytes from 192.168.0.41: icmp_seq=2 ttl=64 time=2.571 msec
Once the unit is seen on the network, you can check the data is there using a browser:
http://192.168.0.41/index.html?em345678
E01ÈO701TF: 81.1HU:81.0%IL 29.9
means we are getting readings for temperature, humidity and illumination.
The setup was performed using a windows computer as the software provided is windows, but all other work is done under linux.
I am presuming you can setup nagios to monitor a service and have setup contacts, contact groups and hostgroups already. If you are not familiar with setting up nagios, there is a good tutorial here and the nagios documentation is excellent.
Download the nagios plugin from here. Move to the nagios plugins directory, under RH9 it is /usr/lib/nagios/plugins/
Configure the host
# vi /etc/nagios/hosts.cfg
I named the host "hvac1", you can substitute anything you like.
# 'hvac1' host definition
define host{
use generic-host ; Name of host template to use
host_name hvac1
alias HVAC1
address 192.168.0.41
check_command check-host-alive
max_check_attempts 20
notification_interval 60
notification_period 24x7
notification_options d,u,r
}
Next, add the checkcommand to /etc/nagios/checkcommands.cfg
# vi /etc/nagios/checkcommands.cfg
# 'check_temp' command definition
define command{
command_name check_temp
command_line $USER1$/check_em01 -H $HOSTADDRESS$ --tw $ARG1$ --tc $ARG2$
}
# 'check_humidity' command definition
define command{
command_name check_humidity
command_line $USER1$/check_em01 -H $HOSTADDRESS$ --hw $ARG1$ --hc $ARG2$
}
# 'check_light command definition
define command{
command_name check_light
command_line $USER1$/check_em01 -H $HOSTADDRESS$ --iw $ARG1$ --ic $ARG2$
}
Then add the service configuration
# vi /etc/nagios/services.cfg
# Service definition
define service{
use generic-service ; Name of service template to use
host_name hvac1
service_description TEMPERATURE
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups router-admins
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_temp!60,88!40,90
}
# Service definition
define service{
use generic-service ; Name of service template to use
host_name hvac1
service_description HUMIDITY
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups router-admins
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_humidity!20,70!10,80
}
# Service definition
define service{
use generic-service ; Name of service template to use
host_name hvac1
service_description ILLUMINATION
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups router-admins
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_light!40,60!20,70
}
Restart nagios
service nagios restart
You should see three entries for hvac1. Alter the settings in the service configuration to cause nagios to trigger WARNING or CRITICAL staus alerts to test everything is functioning properly.
Click for larger image
I am presuming you have mrtg installed and updating via a cron job or daemon. Refer to documentation here to get to this stage.
Download the mrtg script here and put in Nagios plugin directory (or anywhere else you want), in my case
/usr/lib/nagios/plugins/
My mrtg was installed from an RPM, so the paths may differ if you compiled yourself.
Edit config file for mrtg:
# vi /etc/mrtg/neptune.cfg
and add these lines
Target[hvac1t]: `/usr/lib/nagios/plugins/mrtg-em01 -H 192.168.0.41
-t`
MaxBytes[hvac1t]: 110
Title[hvac1t]: Temperature Average
YLegend[hvac1t]:Temp
ShortLegend[hvac1t]: temp
Legend1[hvac1t]: The 1 minute temperature averages as an integer.
Legend2[hvac1t]: The 5 minute temperature averages as an integer.
LegendI[hvac1t]: 1 min
LegendO[hvac1t]: 5 min
Options[hvac1t]: gauge,growright,nopercent
PageTop[hvac1t]: <h2>HVAC1 Temperature average</h2>
Target[hvac1h]: `/usr/lib/nagios/plugins/mrtg-em01 -H 192.168.0.41
-h`
MaxBytes[hvac1h]: 110
Title[hvac1h]: Humidity Average
YLegend[hvac1h]: Humidity
ShortLegend[hvac1h]: humidity
Legend1[hvac1h]: The 1 minute humidity averages as an integer.
Legend2[hvac1h]: The 5 minute humidity averages as an integer.
LegendI[hvac1h]: 1 min
LegendO[hvac1h]: 5 min
Options[hvac1h]: gauge,growright,nopercent
PageTop[hvac1h]: <h2>HVAC1 Humidity Average</h2>
Target[hvac1l]: `/usr/lib/nagios/plugins/mrtg-em01 -H 192.168.0.41
-l`
MaxBytes[hvac1l]: 1000
Title[hvac1l]: Illumination Average
YLegend[hvac1l]: Illumination
ShortLegend[hvac1l]: illumination
Legend1[hvac1l]: The 1 minute illumination averages as an integer.
Legend2[hvac1l]: The 5 minute illumination averages as an integer.
LegendI[hvac1l]: 1 min
LegendO[hvac1l]: 5 min
Options[hvac1l]: gauge,growright,nopercent
PageTop[hvac1l]: <h2>HVAC1 Illumination Average</h2>
If the plugin is in the right place and mrtg is running properly, you should see files appear in the mrtg output directory, which is /var/www/html/mrtg by default on my installation. That's all there is to it.
[root@neptune mrtg]# ls
total 368k
drwxr-xr-x 2 root root 4.0k Feb 26 15:50 .
drwxr-xr-x 6 root root 4.0k Feb 26 11:18 ..
-rw-r--r-- 1 root root 1.6k Feb 26 15:50 hvac1h-day.png
-rw-r--r-- 1 root root 7.1k Feb 26 15:50 hvac1h.html
-rw-r--r-- 1 root root 47k Feb 26 15:50 hvac1h.log
-rw-r--r-- 1 root root 1.3k Feb 26 15:07 hvac1h-month.png
-rw-r--r-- 1 root root 47k Feb 26 15:45 hvac1h.old
-rw-r--r-- 1 root root 1.5k Feb 26 15:40 hvac1h-week.png
-rw-r--r-- 1 root root 1.7k Feb 26 15:07 hvac1h-year.png
-rw-r--r-- 1 root root 1.6k Feb 26 15:50 hvac1l-day.png
-rw-r--r-- 1 root root 7.2k Feb 26 15:50 hvac1l.html
-rw-r--r-- 1 root root 47k Feb 26 15:50 hvac1l.log
-rw-r--r-- 1 root root 1.3k Feb 26 15:07 hvac1l-month.png
-rw-r--r-- 1 root root 47k Feb 26 15:45 hvac1l.old
-rw-r--r-- 1 root root 1.5k Feb 26 15:40 hvac1l-week.png
-rw-r--r-- 1 root root 1.7k Feb 26 15:07 hvac1l-year.png
-rw-r--r-- 1 root root 1.5k Feb 26 15:50 hvac1t-day.png
-rw-r--r-- 1 root root 7.0k Feb 26 15:50 hvac1t.html
-rw-r--r-- 1 root root 47k Feb 26 15:50 hvac1t.log
-rw-r--r-- 1 root root 1.3k Feb 26 15:07 hvac1t-month.png
-rw-r--r-- 1 root root 47k Feb 26 15:45 hvac1t.old
-rw-r--r-- 1 root root 1.4k Feb 26 15:40 hvac1t-week.png
-rw-r--r-- 1 root root 1.6k Feb 26 15:07 hvac1t-year.png
Sensors at work (Click for larger image)
Revision date: Feb 24 2004
Copyright Chris Mason © 2004