apc discovery: Get a count of banks before pulling info

* On my device (AP7901 / AOS v3.9.0 / App v3.7.4) discovery would keep
  clobbering the bank and current sensor.  Looking in to it the oid
  should be used for current and not bank.  To fix this now it pulls
  a count of banks using the `rPDULoadDevNumBanks.0` oid. Per MIB that
  will return 0 if no banks are found.  In which case skip the bank
  detection.

* Also update PowerNet-MIB to v4.1.7 released 2015-08-05
This commit is contained in:
Todd Eddy
2016-02-20 19:37:59 -05:00
parent 44a1542278
commit 83d739b5ae
2 changed files with 785 additions and 195 deletions

View File

@@ -58,7 +58,10 @@ if ($device['os'] == 'apc') {
unset($oids);
// v2 firmware- first bank is total, v3 firmware, 3rd bank is total
$oids = snmp_walk($device, 'rPDULoadStatusIndex', '-OsqnU', 'PowerNet-MIB');
$bank_count = snmp_get($device, 'rPDULoadDevNumBanks.0', '-Oqv', 'PowerNet-MIB');
if ($bank_count > 0) {
$oids = snmp_walk($device, 'rPDULoadStatusIndex', '-OsqnU', 'PowerNet-MIB');
}
// should work with firmware v2 and v3
if ($oids) {
echo 'APC PowerNet-MIB Banks ';

File diff suppressed because it is too large Load Diff