################################################################################

Esensors EM01 Plugin (C VERSION).
Last Updated: August 11th, 2005
Description: This plugin reports the temperature, humidity and illumination
		 from an eSensors EM01 HVAC Monitor.
		 This plugin is written mainly for Nagios, but can be
		 easily used for other software too.

File name: check_em01.c

Language: C

OS: Unix/Linux

Contact Us:
4240 Ridge Lea Rd
Suite 37
Amherst, NY 14226

Tel: (716) 837-8719
Fax: (716) 837-8740
Email: TechHelp@eEsensors.com

########## COMPILE ###########
##############################

To compile, you will need GNU C compiler 'gcc' and all standard libraries 
installed. The gcc version we tested with is 3.2.2 but it should be able to 
work with any other versions, too.

At the prompt:
 gcc check_em01.c -o check_em01

This will create the executable 'check_em01'. Place this executable into your
plugins directory. (For Nagios, this is usually /usr/local/nagios/libexec )

########## BASIC USAGE #######
##############################

To use the plugin: 
 check_em01 [hostname] [T/H/I] [LowWarning HighWarning LowCritical HighCritical]

Only the hostname is mandatory. The rest of the arguments are optional.
T is for Temperature data, H for Humidity data and I for Illumination data.
Note that the warning and critical limit pairs, if specified, MUST be 
specified together. You cannot just specify the warning limits without the 
critical limits or vice versa.

Examples:
This will return all HVAC data: 
 check_em01 192.168.0.2
Sample Output:
 TF: 82.5HU:18.8%IL 179.5        Mon Apr 11 13:05:16 2005

This will return only Illumination data: 
 check_em01 192.168.0.2 I
Sample Output:
 (No limits specified) 179.5

This will return temperature data with status: 
 check_em01 192.168.0.2 T 65 85 60 90
Sample Output:
 OK  82.3 F

This will return humidity data with status: 
 check_em01 192.168.0.2 H 25.5 50 15 70.5
Sample Output:
 WARNING 19.1%

####### ADDITIONAL USAGE #####
##############################

If you have the contacts closure module:
 check_em01 [hostname] C

Examples:
This will return contacts closure status:
 check_em01 192.168.0.2 C
Sample Output:
 OK Contacts Close
 		or
 CRITICAL Contacts Open!

If you have the voltage measurement module:
  check_em01 [hostname] V [LowWarning HighWarning LowCritical HighCritical]
The hostname and 'V' is mandatory. The warning & critical limits are optional.
Examples:
This will return the voltage reading:
 check_em01 192.168.0.2 V
Sample Output:
  (No limits specified) 12.5 V

This will return the voltage reading with status:
 check_em01 192.168.0.2 V 11 13 10 14
Sample Output:
  OK 12.5 V
  
If you have the RTD Temperature module:
  check_em01 [hostname] R [LowWarning HighWarning LowCritical HighCritical]
The hostname and 'R' is mandatory. The warning & critical limits are optional.
Examples:
This will return the RTD temperature reading:
 check_em01 192.168.0.2 R
Sample Output:
  (No limits specified) RTD Temperature:  82.3 F

This will return RTD temperature data with status: 
 check_em01 192.168.0.2 R 65 85 60 90
Sample Output:
 OK RTD Temperature: 82.3 F

#####################################
########## NAGIOS INSTALLATION ######

#####################################
########## NAGIOS INSTALLATION ######

First copy new em01 plugin into Nagios libexec directory 
(/usr/local/nagios/libexec), repleace old one. Do not forget to 
change this file to executable.

Next append the files in Nagios_Config directory into the respective
configuration file in Nagios etc directory. Add the websensor to hosts.cfg
and then edit services.cfg to include the new websensor host. Change the services
template to monitor desired sensor limits.
   
########## DEBUGGING #########
##############################

If you are having trouble with the plugin, you can try to debug it.
Edit the file check_em01.c and change line #3 from '#undef' to '#define'

1	/* Print Debug Info....
2	
3	#define DEBUG
4	...

Now compile the program according to the instructions above.
Run the plugin again to see details on where the plugin is failing and why.
If you still have trouble with this plugin, please feel free to contact us.

########## LICENSE ###########
##############################

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

################################################################################
