Monitoring APC UPS devices by using check_snmp plugin

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
zetbee
Posts: 1
Joined: Wed Jan 20, 2016 1:18 pm

Monitoring APC UPS devices by using check_snmp plugin

Post by zetbee »

Hi all,

I'm working on UPS monitoring by using SNMP protocol. To achieve that I'm using check_snmp plugin. And it's working perfectly fine. Well. For most of the checks :-)

I have a problem with one particular OID. Most of the checks are returning numeric or text data - which is good. So I can get UPS location, battery charge, UPS temperature, etc.
But there is one OID which is basically returning an ASCII string containing 64 flags representing the current state(s) of the UPS. The OID name is:

upsBasicStateOutputState (1.3.6.1.4.1.318.1.1.1.11.1.1)


The flags are numbered 1 to 64, read from left to
right. The flags are defined as follows:

Code: Select all

Flag  1: Abnormal Condition Present
Flag  2: On Battery
Flag  3: Low Battery
Flag  4: On Line    
                    
Flag  5: Replace Battery
Flag  6: Serial Communication Established
Flag  7: AVR Boost Active
Flag  8: AVR Trim Active 
                         
Flag  9: Overload
Flag 10: Runtime Calibration 
Flag 11: Batteries Discharged
Flag 12: Manual Bypass
                             
Flag 13: Software Bypass
Flag 14: In Bypass due to Internal Fault
Flag 15: In Bypass due to Supply Failure
Flag 16: In Bypass due to Fan Failure   
                                        
Flag 17: Sleeping on a Timer            
Flag 18: Sleeping until Utility Power Returns
Flag 19: On
Flag 20: Rebooting
                  
Flag 21: Battery Communication Lost 
Flag 22: Graceful Shutdown Initiated
Flag 23: Smart Boost or Smart Trim Fault
Flag 24: Bad Output Voltage
Flag 25: Battery Charger Failure
Flag 26: High Battery Temperature    
Flag 27: Warning Battery Temperature 
Flag 28: Critical Battery Temperature
Flag 29: Self Test In Progress   
Flag 30: Low Battery / On Battery
Flag 31: Graceful Shutdown Issued by Upstream Device
Flag 32: Graceful Shutdown Issued by Downstream Device
Flag 33: No Batteries Attached
Flag 34: Synchronized Command is in Progress
Flag 35: Synchronized Sleeping Command is in Progress  
Flag 36: Synchronized Rebooting Command is in Progress 
Flag 37: Inverter DC Imbalance 
Flag 38: Transfer Relay Failure
Flag 39: Shutdown or Unable to Transfer
Flag 40: Low Battery Shutdown
Flag 41: Electronic Unit Fan Failure
Flag 42: Main Relay Failure
Flag 43: Bypass Relay Failure
Flag 44: Temporary Bypass
Flag 45: High Internal Temperature
Flag 46: Battery Temperature Sensor Fault
Flag 47: Input Out of Range for Bypass
Flag 48: DC Bus Overvoltage
Flag 49: PFC Failure
Flag 50: Critical Hardware Fault
Flag 51: Green Mode/ECO Mode
Flag 52: Hot Standby
       
Flag 53: Emergency Power Off (EPO) Activated
Flag 54: Load Alarm Violation
Flag 55: Bypass Phase Fault
Flag 56: UPS Internal Communication Failure    
Flag 57: Efficiency Booster Mode
Flag 58: Off
Flag 59: Standby
Flag 60: <Not Used>
Flag 61: <Not Used>
Flag 62: <Not Used>
Flag 63: <Not Used>
Flag 64: <Not Used>

So. For example - when I'm running check_snmp on upsBasicStateOutputState the typical result visible in Nagios UI (and in the system - in general) is:

Image

SNMP OK - "0001010000000000001000000000000000000000000000000010000000000000"

The string above basically means: UPS is On-Line, Serial Communication Established, UPS On, Green Mode/ECO Mode is enabled

Is there a way - to parse the string and get the text descriptions instead of raw SNMP data?
Last edited by zetbee on Thu Jan 21, 2016 5:22 am, edited 2 times in total.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitoring APC UPS devices by using check_snmp plugin

Post by tmcdonald »

Unfortunately you'll need to write the parsing logic for this yourself. Nagios has no way of knowing what those numbers mean unless you tell it, so usually in this case you write a script (perl, python, bash, whatever) that runs the check_snmp plugin then parses out the results, and then nagios runs that wrapper script instead of check_snmp directly.

Our plugin development guidelines can be found here:

https://nagios-plugins.org/doc/guidelines.html
Former Nagios employee
Locked