Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

UPS Checks

Current Version
1.2
Last Release Date
2014-11-26
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI
Owner
Hits
125606
Files:
FileDescription
check_ups_mge.plMGE UPS
check_ups_pow.plPOW UPS
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Three perl scripts to monitor APC, Merlin Guerin and Powerware UPS. Performance data are also provided using groundwork like syntax.

Updated by Alexander Rudolf
- added support for external temperature sensor (exttemp...)
Hint: expecting the value unit is Celsius ('1'), if iemStatusProbeTempUnits.1 (.1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.1) is Fahrenheit ('2') we will get wrong data
- changed battery temperature values from output
Before: OK - Smart-UPS RT 8000 RM XL ... - TEMPERATURE 27 C - ...
Now: OK - Smart-UPS RT 8000 RM XL ... - BATT TEMP 27 C - EXT TEMP 23 C - ...
- added warn and crit values to performance data output as well as units
- tested with Smart-UPS 5000/8000 and "PowerNet SNMP Agent SW v2.2 compatible"

Updated by Oliver Skibbe:
- warn/crit values defined per variable
- get watt hour if oid exists (Smart UPS 2200)
- calculate remaining time in minutes on battery (bit ugly, but seems working)
critical if below $remaining_time_crit value
- changed return string to add CRIT/WARN to corresponding failed value
- APC: added battery replacement indicator

Before: CRIT - Smart-UPS RT 10000 XL - BATTERY CAPACITY 100% - STATUS NORMAL - OUTPUT LOAD 31% - TEMPERATURE 23 C

After: CRIT - Smart-UPS RT 10000 XL - CRIT BATTERY CAPACITY 50% - STATUS NORMAL - OUTPUT LOAD 31% - TEMPERATURE 23 C

- Added multiline ouput for firmware,manufacture date and serial number
FIRMWARE: UPS 05.0 / COM 02.1 / UBL 05.0 / CBL 5.21 (ID17) - MANUFACTURE DATE: 12/12/2012 - SERIAL: DummySerial
These three perl scripts have been modified from a Altinity script to report on :

- Global Status
- UPS Type
- Battery Capacity
- Output Load in %
- Temperature
- Output load in watt hours
- Remaining time on battery
- Serial number
- Manufacture date
- Firmware

For the three different types of UPS we use :
- APC (Smart UPS 3000 RM, 2200, 1500, 5000 and RT10000 XL)
- MGE (Merlin Guerin Pulsar Extreme 3000 VA)
- Powerware (PW9125)

Typical Output :

OK - Smart-UPS RT 10000 XL - BATTERY CAPACITY 100% - STATUS NORMAL - OUTPUT LOAD 16% - BATT TEMP 29 C - EXT TEMP 23 C - 62 MINUTES REMAINING
FIRMWARE: 476.18.W - MANUFACTURE DATE: 01/27/12 - SERIAL: Dummy Serial|'load'=16%;70;80;; 'temp'=29C;31;33;; 'exttemp'=23C;26;30;; 'remaining_minutes'=62min;;5;;

OR:
CRITICAL - Smart-UPS RT 10000 XL - CRIT BATTERY REPLACEMENT NEEDED - STATUS NORMAL - OUTPUT LOAD 20% - TEMPERATURE 25 C - 50 MINUTES REMAINING
FIRMWARE: 476.18.W - MANUFACTURE DATE: 10/21/12 - SERIAL: ASDF123


Performance data is also provided to graph Load, Remaining time, Temperature and optional: load in Watt hours
Reviews (1)
byRadoS, February 5, 2015
0 of 1 people found this review helpful
I use the ups_acp.pl Script.
a) it provides some useful info, thanks
b) some parts may be incorrect (don't know enough about SNMP/UPS-APC, guessing from code where it checks the same SNMP value twice)
c) code fails to operate with embedded perl when enabled in nagios (which is by default on ubuntu 14/04)

I changed quite a bit for what I think is correct for b) and definitely is necessary for c).
If I did wrong, then correct my corrections as needed. ;-)
Enjoy

======

*** check_ups_apc.pl 2014-03-20 16:58:31.000000000 +0100
--- jjj.pl 2015-02-02 18:34:43.000000000 +0100
***************
*** 39,99 ****
# After: CRIT - Smart-UPS RT 10000 XL - CRIT BATTERY CAPACITY 50% - STATUS NORMAL - OUTPUT LOAD 31% - TEMPERATURE 23 C
# - Added multiline output for firmware,manufacture date and serial number

use Net::SNMP;
use Getopt::Std;
# DEBUGGING PURPOSE
use Data::Dumper;

! $script = "check_ups_apc.pl";
! $script_version = "1.2";

! $metric = 1;

! $version = "1"; # SNMP version
! $timeout = 2; # SNMP query timeout
# $warning = 100;
# $critical = 150;
! $status = 0;
! $returnstring = "";
! $perfdata = "";
!
! $community = "public"; # Default community string
!
! $oid_sysDescr = ".1.3.6.1.2.1.1.1.0";
! $oid_serial_number = ".1.3.6.1.4.1.318.1.1.1.1.2.3.0";
! $oid_firmware = ".1.3.6.1.4.1.318.1.1.1.1.2.1.0";
! $oid_manufacture_date = ".1.3.6.1.4.1.318.1.1.1.1.2.2.0";
! $oid_upstype = ".1.3.6.1.4.1.318.1.1.1.1.1.1.0";
! $oid_battery_capacity = ".1.3.6.1.4.1.318.1.1.1.2.2.1.0";
! $oid_output_status = ".1.3.6.1.4.1.318.1.1.1.4.1.1.0";
! $oid_output_current = ".1.3.6.1.4.1.318.1.1.1.4.2.4.0";
! $oid_output_load = ".1.3.6.1.4.1.318.1.1.1.4.2.3.0";
! $oid_battemperature = ".1.3.6.1.4.1.318.1.1.1.2.2.2.0";
! $oid_exttemperature = ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1";
! $oid_remaining_time = ".1.3.6.1.4.1.318.1.1.1.2.2.3.0";
# optional, Smart-UPS 2200 support this
! $oid_current_load_wh = ".1.3.6.1.4.1.318.1.1.1.4.3.6.0";

! $oid_battery_replacment = ".1.3.6.1.4.1.318.1.1.1.2.2.4.0";

! $upstype = "";
! $battery_capacity = 0;
! $output_status = 0;
! $output_current = 0;
! $output_load = 0;
! $battemperature = 0;
! $exttemperature = 0;
# crit / warn values ! $remaining_time_crit = 5;
! $output_load_crit = 80; ! $output_load_warn = 70;
! $battemperature_crit = 33; ! $battemperature_warn = 31;
! $exttemperature_crit = 30;
! $exttemperature_warn = 26; ! $battery_capacity_crit = 35;
! $battery_capacity_warn = 65;
# Do we have enough information? if (@ARGV var_bind_names()) {
***************
*** 233,249 ****
--- 243,262 ----
}
}

+ my $firmware;
# some useful stuff
if (defined($s->get_request($oid_firmware))) {
foreach ($s->var_bind_names()) {
$firmware = $s->var_bind_list()->{$_};
}
}
+ my $serial_number;
if ( defined ( $s->get_request($oid_serial_number))) {
foreach ($s->var_bind_names()) {
$serial_number = $s->var_bind_list()->{$_};
}
}
+ my $manufacture_date;
if ( defined ( $s->get_request($oid_manufacture_date))) {
foreach ($s->var_bind_names()) {
$manufacture_date = $s->var_bind_list()->{$_};
***************
*** 279,285 ****
#######################################################

if (!defined($s->get_request($oid_battery_replacment))) {
! if (!defined($s->get_request($oid_battery_replacement))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
--- 292,298 ----
#######################################################

if (!defined($s->get_request($oid_battery_replacment))) {
! if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
***************
*** 290,295 ****
--- 303,309 ----
return 1;
}
}
+ my $battery_replacement;
foreach ($s->var_bind_names()) {
$battery_replacement = $s->var_bind_list()->{$_};
}
***************
*** 308,313 ****
--- 322,328 ----
return 1;
}
}
+ my $remaining_time;
foreach ($s->var_bind_names()) {
$remaining_time = $s->var_bind_list()->{$_}; # returns (days),(hours),(minutes),seconds
}
***************
*** 453,469 ****
if ( defined ( $remaining_time ) ) {
# convert time to minutes
my @a = split(/ /,$remaining_time);
! my $timeUnit = @a[1];
my $minutes = 0;

if ( $timeUnit =~ /hour/ ) {
# hours returned
! my @minutesArray = split(/:/,@a[2]);
! $minutes = @a[0] * 60;
! $minutes = $minutes + @minutesArray[0];
} elsif ( $timeUnit =~ /minute/ ) {
# minutes returned
! $minutes = @a[0];
} else {
# seconds returned?
$minutes = 0;
--- 468,484 ----
if ( defined ( $remaining_time ) ) {
# convert time to minutes
my @a = split(/ /,$remaining_time);
! my $timeUnit = $a[1];
my $minutes = 0;

if ( $timeUnit =~ /hour/ ) {
# hours returned
! my @minutesArray = split(/:/,$a[2]);
! $minutes = $a[0] * 60;
! $minutes = $minutes + $minutesArray[0];
} elsif ( $timeUnit =~ /minute/ ) {
# minutes returned
! $minutes = $a[0];
} else {
# seconds returned?
$minutes = 0;