I have a bunch of APC UPS probes I have built but here is the mother of all APC probes! One of the OIDs in an APC ups is a 64bit binary string. 32 of those values are used to indicate various issues. This probe determines if the string is "normal" and if not it finds the first error and returns the result.
Note: The probe line changed, the "False" test in the probe did not work. The graphic I attached still has the old version if you want to compare.
Probe - error line
if(string_size(oid("1.3.6.1.4.1.318.1.1.1.1.1.1.0",10,5)<>0),if(ups_basic_state() = 1, "" ,concatenate( "UPS State Error; ", ups_basic_state())),"Cant read UPS State")
Function
if(string_size(oid("1.3.6.1.4.1.318.1.1.1.1.1.1.0",10,5)<>0),
if(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5)="0001010000000000001000000000000000000000000000000000000000000000",1,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),0,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),1,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),2,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),3,1)=1,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),4,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),5,1)=1,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),6,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),7,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),8,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),9,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),10,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),11,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),12,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),13,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),14,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),15,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),16,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),17,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),18,1)=1,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),19,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),20,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),21,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),22,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),23,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),24,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),25,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),26,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),27,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),28,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),29,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),30,1)=0,
if(string_substring(oid("1.3.6.1.4.1.318.1.1.1.11.1.1.0",10,5),31,1)=0,
"Couldn't determine UPS trouble"
,"Synchronized command is in progress")
,"No Batteries Attached")
,"Graceful Shutdown Issued by Downstream Device")
,"Graceful Shutdown Issued by Upstream Device")
,"Low Battery or On Battery")
,"Self Test In Progress")
,"High Battery Temperature")
,"Battery Charger Failure")
,"Bad Output Voltage")
,"Smart Boost or Smart Trim Fault")
,"Graceful Shutdown Initiated")
,"Battery Communication Lost")
,"Rebooting")
,"On")
,"Sleeping until Utility Power Returns")
,"Sleeping on a Timer")
,"In Bypass due to Fan Failure")
,"In Bypass due to Supply Failure")
,"In Bypass due to Internal Fault")
,"Software Bypass")
,"Manual Bypass")
,"Batteries Discharged")
,"Runtime Calibration")
,"Overload")
,"AVR Trim Active")
,"AVR Boost Active")
,"Serial Communication Established")
,"Replace Battery")
,"On Line")
,"Low Battery")
,"On Battery")
,"Abnormal Condition Present")
)
,"False")
ups_state_test-Probe.png
ups_basic_state-func.png
You do not have the required permissions to view the files attached to this post.