PDA

View Full Version : Trigger for UPS


Lovespider
20-04-2005, 11:16
Hello,
APC UPS can be monitored via SNMP if they have a NIC installed.
I'm using the "upsBasicStateOutputState" value that returns a 64 chars string representing a binary set of flags (OID is .1.3.6.1.4.1.318.1.1.1.11.1.0).
I try to explain better: all charachters can be 0 or 1, depending of the position in this string, they mean different things (I report only the first 4):

Flag 1: Abnormal Condition Present
Flag 2: On Battery
Flag 3: Low Battery
Flag 4: On Line
etc etc etc

Problem: if I want to set a trigger for the "On Battery" status I should check the 4th flag but the triggers' formula does not have a mid$ left$ or right$ like in BASIC language for instance.
Do you have an idea how to solve it?

B/R Lovespider

sauron
20-04-2005, 12:06
Use digit value. Four flag is 16 ( 2 in 4 ).

Lovespider
20-04-2005, 14:10
How? the SNMP returns only a string not a value.

antifuchs
20-04-2005, 14:52
How? the SNMP returns only a string not a value.

I don't think that's easy to do, then. You /could/ check for every possible permutation of the string, but I don't think that's a good idea. You could either nag Alexei for a regex-type match function, or look for a different OID to base the check on.

Don't APC UPSes support the UPS management MIB via .1.3.6.1.2.1.33? the gauge UPS-MIB::upsAlarmsPresent.0 looks like a very useful thing to test for, if your UPS supports it.

Lovespider
21-04-2005, 11:51
Mmmh, my UPS doesn't support that MIB branch. By the way I found this OID: .1.3.6.1.4.1.318.1.1.1.4.1.1.0

## According to the APC Powernet MIB the variable .1.3.6.1.4.1.318.1.1.1.4.1.1
## takes the the following values: unknown(1), onLine(2), onBattery(3),
## onSmartBoost(4), timedSleeping(5), softwareBypass(6), off(7), rebooting(8),
## switchedBypass(9), hardwareFailureBypass(10), sleepingUntilPowerReturn(11),
## and onSmartTrim(12), where onLine(2) is the normal state for the UPS

Thanks for support.