Nagios Plugin for Baytech PDU


This is a plugin that checks Baytech PDUs.
It will report Current, Temperature, Power when you give it name of the PDU to be checked.


Make sure to check and if necessary adjust the the path to
Make sure you have Net::SNMP perl module installed

This plugin will first read RPC names table to find which RPCs you have. It will then compare that to name given with '-n' and if there is a match will further lookup data for that RPC.
If no name is specifed with '-n' the plugin will report data for all RPCs which can be up to 16 and that is a lot of data especially if each RPC has multiple breakers you all want to check.

The data plugin can lookup for each RPC is: Current in Amps, Potential difference in Volts, Power use in Watts and Temperature (which you can choose to receive in Celsius or Fahrenheit).
The plugin is designed to report instant values that is why "Max Current" which is also available from PDU data is not used (if you need that modify plugin code yourself - its easy to replace 'current' with that and I provided OID in the code already).

You can choose to just report particular data or to check data and have plugin report WARNING or CRITICAL if its outside of expected range.
To just report the data specify for example "--current" with no additional values after.
If you want to have thereshold for it then specify parameter as for example "--current=5,15".
That means you want WARNING if current is 15A. Critical levels follow WARNING, so it could be "--current=5,15,1,19".
If you want to specify some but not other thresholds, then just don't specify value between ",," so for example if you want CRITICAL alert at above 19A and no other thresholds, it would be "--current=,,,15".

In addition each RPC can have multiple breakers.
I've dealt with the ones that have 4 breakers per RPC corresponding to outlets A1-12, A13-24, B1-12, B13-14.

In order to get breakers data use "--breakers" as a parameter. Irregardless of actual outlets the breakers will only be numbered (1,2,3,4,etc) and when reported by plugin will be specified as B1, B2, etc.
Normally individual breaker values are not checked against the thresholds (often enough people use RPC as redundant power source so one breaker would have all the load while the other one none).
If you do want to check against thresholds then use "--breakers=check".

For temperature as mentioned you can specify output format to be either Celsius, Fahrenheit or more "real" (physically for formulas, etc) Kelvin.
You specify it with "-o" followed by C or F or K, for example for Fahrenheit: "-o F".
The default for this plugin is Celsius.

Two other important options need to be mentioned:

'-f' or '--perfdata' causes all data to be reported back in performance variables You want this if you're going to post-proces the data for example to graph it

'-s' or '--showvalues' causes plugin to report actual data values as part of the output (otherwise it would just report 'Baytech PDU OK' which is not much fun...). This is done is somewhat compact way, here is an example:

./ -H -C public -s -f --voltage --current --temperature --power --breakers -o F -n CAB1

 Baytech PDU OK - CAB1 RPS26DE[2.1] is 119.2V/16.2A/1919W/90.5F (B1 is 119.2V/4.2A/492W, B2 is 119.3V/3.9A/461W, B3 is 119.8V/3.9A/469W, B4 is 120V/4.2A/497W)

Finally if you have any doubt as to what data is available I recommend trying to use this plugin in "debug" mode (with -d switch):

./ -d -H -C ...


./ [-d] -H < host > (-C < snmp_community >) [-2] | (-l login -x passwd [-X pass -L < authp >,< privp >) [-p < port >] [-P < port >] [-T < timeout >] [-n < RPS name >] [--breakers[=check]] [--voltage=< warnmin >,< warnmax >,< critmin >,< critmax >] [--current=< warnmin >,< warnmax >,< critmin >,< critmax >] [--power=< warnmin >,< warnmax >,< critmin >,< critmax >] [--temperature=< warnin >,< warnmax >,< critmin >,< critmax >] [-s] [-f] [-o < out_temp_unit: C|F|K >] [-V]


Flag Description
-d, --debug print extra debugging information
-h, --help print this help message
-V, --version prints version number
-T, --timeout=INTEGER timeout for SNMP in seconds (Default: 5)
-H, --hostname=HOST name or IP address of host to check
-C, -–community=COMMUNITY NAM community name for the SNMP agent (used with v1 or v2c protocols)
-2, --v2c use snmp v2c (can not be used with -l, -x)
-l, --login=LOGIN ; -x, --passwd=PASSWD Login and auth password for snmpv3 authentication If no priv password exists, implies AuthNoPriv
-X, --privpass=PASSWD Priv password for snmpv3 (AuthPriv protocol)
-L, --protocols=< authproto >,< privproto >
authproto Authentication protocol (md5|sha : default md5)
privproto Priv protocols (des|aes : default des)
-P, --port=PORT SNMP port (Default 161)
-n, --name=NAME_REGEX The name of the RPS to check. The name is configured on the Baytech itself, see manual on how to do it (the default is something like RPS26). What you specify here is used as regex however usually its either single name or if you just want all, then dont specify this and all will be checked.
-b, --breakers[=check] In addition to getting data for each PDU also find info about each individual breaker on that PDU (you usually want this!) If you specify --breakers=check then their values are also checked against thresholds (see below)
-c, --current=WARNING_MIN,WARNING_MAX,CRITICAL_MIN,CRITICAL_MAX Current levels for nagios to report WARNING or CRITICAL alert Current is specified in Amps.
-v, --voltage=WARNING_MIN,WARNING_MAX,CRITICAL_MIN,CRITICAL_MAX Voltage levels for nagios alerts. Specified in (unsurisingly) Volts.
-p, --power=WARNING_MIN,WARNING_MAX,CRITICAL_MIN,CRITICAL_MAX Power levels for nagios alerts. Specified in Watts
-t, --temperature=WARNING_MIN,WARNING_MAX,CRITICAL_MIN,CRITICAL_MAX Temperature. Specified in output units (see below)
-o --out_temp_unit=C|F|K What temperature measurement units are used for output and warning/critical - 'C', 'F' or 'K' - default is 'C'
-s, --showvalues Show actual values (current, power, etc) in a result line of this plugin (otherwise will only print 'PDU OK')
-f, --perfdata Perfparse output (data received returned as performance variables)
Enjoy :) and of you have any questions, email me