Date created: Friday, July 29, 2011 9:49:29 AM. Last modified: Tuesday, September 19, 2017 12:02:57 PM

SNMP with APC PDU

In order to use SNMP (for Cacti) to poll some new PDUs for power consumption first the OIDs must be know of the values that need polling (for power consumption). These PDUs (AP8953's) log total power in kWs and Amps, and the PDU is split into two banks (ports 1 - 12, and 13 - 24) giving the Bank 1 total in Amps and the Bank 2 total in Amps.

The easiest way I found to do this was to use snmpwalk and first walk the whole MIB range;

snmpwalk -v 2c -c private 172.22.0.186 .iso

This spat out pages and pages of junk but most importantly some stand out values that didn't seem like they were any sort of default setting or value. I plugged something else into the PDU to change the current consumtion leveI and walked the whole range again. I "grep'ed" out as much crud as I could (its a 24 port, 32 amp PDU, so I ignored any value that said 24 or 32, and any values that where just 1, 2, 3, 4...24),  and "diff'ed" the output with the last walk and found these values;

SNMPv2-SMI::enterprises.318.1.1.12.1.16.0 = INTEGER: 120
SNMPv2-SMI::enterprises.318.1.1.12.1.17.0 = INTEGER: -1
SNMPv2-SMI::enterprises.318.1.1.12.1.18.0 = INTEGER: 150

Looking in the web interface I see the total device load is 0.15kW; I don't believe in coinsidences. I also noticed these odd values;

SNMPv2-SMI::enterprises.318.1.1.12.2.3.1.1.2.1 = Gauge32: 6
SNMPv2-SMI::enterprises.318.1.1.12.2.3.1.1.2.2 = Gauge32: 0
SNMPv2-SMI::enterprises.318.1.1.12.2.3.1.1.2.3 = Gauge32: 5

The web interace shows a total load of 0.6 Amps, with Bank 1 running 0 amps (there is nothing plugged in Bank 1) and 0.5 Amps on Bank 2 (one server and monitor). Again, it can't be a coincidense. Lets add a few more servers and monitors to the PDU and grab the values again:

$ snmpget -v 2c -c private 172.22.0.186 1.3.6.1.4.1.318.1.1.12.1.16.0
SNMPv2-SMI::enterprises.318.1.1.12.1.16.0 = INTEGER: 410
$ snmpget -v 2c -c private 172.22.0.186 1.3.6.1.4.1.318.1.1.12.1.18.0
SNMPv2-SMI::enterprises.318.1.1.12.1.18.0 = INTEGER: 430
$ snmpget -v 2c -c private 172.22.0.186 1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1
SNMPv2-SMI::enterprises.318.1.1.12.2.3.1.1.2.1 = Gauge32: 19
$ snmpget -v 2c -c private 172.22.0.186 1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.2
SNMPv2-SMI::enterprises.318.1.1.12.2.3.1.1.2.2 = Gauge32: 7
$ snmpget -v 2c -c private 172.22.0.186 1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.3
SNMPv2-SMI::enterprises.318.1.1.12.2.3.1.1.2.3 = Gauge32: 12

Match that all up with what the web interface says and we're cooking;
We are running at 0.41Kw (0.43kW was a peak when turning equipment on), the total load is 1.9 Amps, Bank 1 load is 0.7 Amps and Bank 2 load is 1.2 Amps. 

Finally using the web interface I set the overload threashold to 0.2kW to trigger the threshold; then I walked and diff'ed the whole SNMP output again, reset the over load threshold, dropp, walk and diff, repeat until the juices run clear...Finally;

$ snmpget -v 2c -c private 172.22.0.186 1.3.6.1.4.1.318.1.1.26.4.3.1.4.1
SNMPv2-SMI::enterprises.318.1.1.26.4.3.1.4.1 = INTEGER: 2
$ snmpget -v 2c -c private 172.22.0.186 1.3.6.1.4.1.318.1.1.26.4.3.1.4.1
SNMPv2-SMI::enterprises.318.1.1.26.4.3.1.4.1 = INTEGER: 3
$ snmpget -v 2c -c private 172.22.0.186 1.3.6.1.4.1.318.1.1.26.4.3.1.4.1
SNMPv2-SMI::enterprises.318.1.1.26.4.3.1.4.1 = INTEGER: 4

1.3.6.1.4.1.318.1.1.26.4.3.1.4.1 reads 2 at normal operations, 3 when we are over the warning limit (a lower threshold, nearing an overload) and 4 means we are over the overload threshold.