Uno degli apparati più importanti di un infrastruttura IT sono gli UPS che garantiscono un funzionamento degli apparati anche in mancanza di corrente elettrica. Ci sono vari tipi di UPS (APC, Chloride, Somotec, NetVision, ..) che se hanno un modulo di rete possono essere monitorizzati con il protocollo SNMP. Per tutti gli UPS APC si può usare questo plugin:
Per UPS con un interfaccia standard UPS/SNMP o dei tipi NetVision, Somtec usa questo plugin:
L’ultimo plugin inoltre va bene anche per montorizzare degli APC-ATS (Automatic Transfer Switches).
#./check_snmp_apc_ups.pl --help
check_snmp_apc_ups.pl version [unknown] calling Getopt::Std::getopts (version 1.05 [paranoid]),
running under Perl version 5.8.8.
Usage: check_snmp_apc_ups.pl [-OPTIONS [-MORE_OPTIONS]] [–] [PROGRAM_ARG1 …]
The following single-character options are accepted:
With arguments: -h -H -C -w -c
Options may be merged together. — stops processing of options.
Space is not required between options and their arguments.
[Now continuing due to backward compatibility and excessive paranoia.
See “perldoc Getopt::Std” about $Getopt::Std::STANDARD_HELP_VERSION.]
No hostname specified
—————————————————————–
check_snmp_apcups v2.1.0
Monitors APC SmartUPS via AP9617 SNMP management card.
Usage: check_snmp_apcups -H -c […]
Options: -H Hostname or IP address
-C Community (default is public)
—————————————————————–
Copyright 2004 Altinity Limited
This program is free software; you can redistribute it or modify
it under the terms of the GNU General Public License
—————————————————————–
#./check_snmp_ups.pl --help
SNMP UPS Monitor for Nagios version 1.0
GPL Licence, (c)2009 Jürgen Vigna
Usage: ./check_snmp_ups.pl [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (general|netvision|socomec|apcats) [-B <warn,crit>] [-O <warn,crit>] [-A ] [-f] [-t ] [-o ] [-i ] [-V]
-v, –verbose
print extra debugging information
-h, –help
print this help message
-H, –hostname=HOST
name or IP address of host to check
-C, –community=COMMUNITY NAME
community name for the host’s SNMP agent (implies v1 protocol)
-2, –v2c
Use snmp v2c
-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=, : Authentication protocol (md5|sha : default md5)
: Priv protocole (des|aes : default des)
-P, –port=PORT
SNMP port (Default 161)
-T, –type=general|netvision|socomec|apcats
Environemental check :
general : general UPS status
netvision : voltage,battery,load and alerts
socomec : voltage,battery,load and alerts
apcats : input source, load
-B, –battery=<%battery left>
Warning,Critical minimum battery level in percent (default: 80,50)
-O, –load=
Warning,Critical Maximum Load of UPS before giving a warning (default: 75,90)
-A, –voltage=
Warning Minimum Voltage of UPS before giving a warning (default: 200)
-o, –output_lines= Number of output lines to check (default: 1)
-i, –input_lines= Number of input lines to check (default: 1)
-f, –perfparse
Perfparse compatible output
-t, –timeout=INTEGER
timeout for SNMP in seconds (Default: 5)
-V, –version
prints version number
hi, i’ve found two bugs in check_snmp_ups.pl script version 2.3: Include of APC UPS MIB base (Patrick Zambelli ).
Script shows not correct error.
$ ./check_ups_input_voltage_original.pl -t 60 -A 210 -T netvision -C public -H x.x.x.x
Argument “v6.0.1″ isn’t numeric in numeric lt (<) at ./check_ups_input_voltage_original.pl line 709.
Argument "v6.0.1" isn't numeric in numeric lt (<) at ./check_ups_input_voltage_original.pl line 732.
Argument "v6.0.1" isn't numeric in numeric lt (<) at ./check_ups_input_voltage_original.pl line 755.
Argument "v6.0.1" isn't numeric in numeric lt ( ‘AlarmBatteryBad’,
‘1.3.6.1.4.1.4555.1.1.1.1.6.3.2.0’ => ‘AlarmOnBattery’,
‘1.3.6.1.4.1.4555.1.1.1.1.6.3.3.0’ => ‘AlarmLowBattery’,
etc
and then you have to replace
$output .= ” $netvision_alert_leaf[$i]($$resultat{$key})”
with
$output .= ” $netvision_alert_leaf{$key}($$resultat{$key})”
another bug is Net::SNMP->VERSION equals “v6.0.1”, it’s not numeric, that’s why you can’t compare
“v6.0.1” with “4”.
i think it will be better if you replace
$resultat = (Net::SNMP->VERSION parse(Net::SNMP->VERSION) < 4) ?
what do you think about it?
Hello Simon,
thanks for your feedback I released a new version in this post and tried to fix also the problems you reported. For the OID sort problem I used Sort::Key::OID and I also use now version as you pointed out. This is the link to the new post: http://www.neteye-blog.com/it/2015/07/bring-ups-monitoring-to-a-new-level/
Kind regards,
Jürgen
hi, i’ve found two bugs in check_snmp_ups.pl script version 2.3: Include of APC UPS MIB base (Patrick Zambelli ).
Script shows not correct error.
$ ./check_ups_input_voltage_original.pl -t 60 -A 210 -T netvision -C public -H x.x.x.x
Argument “v6.0.1″ isn’t numeric in numeric lt (<) at ./check_ups_input_voltage_original.pl line 709.
Argument "v6.0.1" isn't numeric in numeric lt (<) at ./check_ups_input_voltage_original.pl line 732.
Argument "v6.0.1" isn't numeric in numeric lt (<) at ./check_ups_input_voltage_original.pl line 755.
Argument "v6.0.1" isn't numeric in numeric lt ( ‘AlarmBatteryBad’,
‘1.3.6.1.4.1.4555.1.1.1.1.6.3.2.0’ => ‘AlarmOnBattery’,
‘1.3.6.1.4.1.4555.1.1.1.1.6.3.3.0’ => ‘AlarmLowBattery’,
etc
and then you have to replace
$output .= ” $netvision_alert_leaf[$i]($$resultat{$key})”
with
$output .= ” $netvision_alert_leaf{$key}($$resultat{$key})”