mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Added 3 Phase APC UPS Support issue #2733 * Added 3 Phase APC UPS Support issue #2733 - v2 * Added 3 Phase APC UPS Support issue #2733 - v3 * Added 3 Phase APC UPS Support issue #2733 - v3 * Added 3 Phase APC UPS Support issue #2733 - v3.1 * Added 3 Phase APC UPS Support issue #2733 - v3.2 * Added 3 Phase APC UPS Support issue #2733 - v3.3 * Added 3 Phase APC UPS Support issue #2733 - v3.4 * Added 3 Phase APC UPS Support issue #2733 - v4 * Added 3 Phase APC UPS Support issue #2733 - v4.1 * Update apc.yaml
This commit is contained in:
committed by
Neil Lathwood
parent
34c35f3627
commit
a368a73825
@@ -3,6 +3,8 @@ text: 'APC Management Module'
|
||||
type: power
|
||||
over:
|
||||
- { graph: device_current, text: Current }
|
||||
- { graph: device_voltage, text: Voltage }
|
||||
- { graph: device_runtime, text: Runtime }
|
||||
discovery:
|
||||
- sysDescr:
|
||||
- APC Web/SNMP Management Card
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
<?php
|
||||
|
||||
// PDU - Phase
|
||||
$oids = snmp_walk($device, 'rPDUStatusPhaseIndex', '-OsqnU', 'PowerNet-MIB');
|
||||
if (empty($oids)) {
|
||||
$oids = snmp_walk($device, 'rPDULoadPhaseConfigIndex', '-OsqnU', 'PowerNet-MIB');
|
||||
}
|
||||
|
||||
if ($oids) {
|
||||
d_echo($oids."\n");
|
||||
|
||||
$oids = trim($oids);
|
||||
if ($oids) {
|
||||
echo 'APC PowerNet-MIB Phase ';
|
||||
}
|
||||
|
||||
$type = 'apc';
|
||||
$precision = '10';
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
@@ -22,7 +18,6 @@ if ($oids) {
|
||||
list($oid,$kind) = explode(' ', $data);
|
||||
$split_oid = explode('.', $oid);
|
||||
$index = $split_oid[(count($split_oid) - 1)];
|
||||
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.'.$index;
|
||||
// rPDULoadStatusLoad
|
||||
$phase_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.'.$index;
|
||||
@@ -46,14 +41,11 @@ if ($oids) {
|
||||
} else {
|
||||
$descr = 'Output';
|
||||
}
|
||||
|
||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($oids);
|
||||
|
||||
// v2 firmware- first bank is total, v3 firmware, 3rd bank is total
|
||||
$bank_count = snmp_get($device, 'rPDULoadDevNumBanks.0', '-Oqv', 'PowerNet-MIB');
|
||||
if ($bank_count > 0) {
|
||||
@@ -63,26 +55,21 @@ if ($bank_count > 0) {
|
||||
if ($oids) {
|
||||
echo 'APC PowerNet-MIB Banks ';
|
||||
d_echo($oids."\n");
|
||||
|
||||
$oids = trim($oids);
|
||||
$type = 'apc';
|
||||
$precision = '10';
|
||||
|
||||
// version 2 does some stuff differently- total power is first oid in index instead of the last.
|
||||
// will look something like "AOS v2.6.4 / App v2.6.5"
|
||||
$baseversion = '3';
|
||||
if (stristr($device['version'], 'AOS v2') == true) {
|
||||
$baseversion = '2';
|
||||
}
|
||||
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid,$kind) = explode(' ', $data);
|
||||
$split_oid = explode('.', $oid);
|
||||
|
||||
$index = $split_oid[(count($split_oid) - 1)];
|
||||
|
||||
$banknum = ($index - 1);
|
||||
$descr = 'Bank '.$banknum;
|
||||
if ($baseversion == '3') {
|
||||
@@ -90,13 +77,11 @@ if ($oids) {
|
||||
$descr = 'Bank Total';
|
||||
}
|
||||
}
|
||||
|
||||
if ($baseversion == '2') {
|
||||
if ($index == '1') {
|
||||
$descr = 'Bank Total';
|
||||
}
|
||||
}
|
||||
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.'.$index;
|
||||
// rPDULoadStatusLoad
|
||||
$bank_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.5.'.$index;
|
||||
@@ -112,36 +97,28 @@ if ($oids) {
|
||||
$limit = snmp_get($device, $limit_oid, '-Oqv', '');
|
||||
$lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', '');
|
||||
$warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', '');
|
||||
|
||||
if ($limit != -1 && $lowlimit != -1 && $warnlimit != -1) {
|
||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($baseversion);
|
||||
}
|
||||
|
||||
unset($oids);
|
||||
|
||||
// Per Outlet Power Bar
|
||||
$oids = snmp_walk($device, '.1.3.6.1.4.1.318.1.1.26.9.4.3.1.1', '-t 30 -OsqnU', 'PowerNet-MIB');
|
||||
if ($oids) {
|
||||
echo 'APC PowerNet-MIB Outlets ';
|
||||
d_echo($oids."\n");
|
||||
|
||||
$oids = trim($oids);
|
||||
$type = 'apc';
|
||||
$precision = '10';
|
||||
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid,$kind) = explode(' ', $data);
|
||||
$split_oid = explode('.', $oid);
|
||||
|
||||
$index = $split_oid[(count($split_oid) - 1)];
|
||||
|
||||
$voltage_oid = '.1.3.6.1.4.1.318.1.1.26.6.3.1.6';
|
||||
// rPDU2PhaseStatusVoltage
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.26.9.4.3.1.6.'.$index;
|
||||
@@ -155,31 +132,25 @@ if ($oids) {
|
||||
$name_oid = '.1.3.6.1.4.1.318.1.1.26.9.4.3.1.3.'.$index;
|
||||
// rPDU2OutletMeteredStatusName
|
||||
$voltage = snmp_get($device, $voltage_oid, '-Oqv', '');
|
||||
|
||||
$current = (snmp_get($device, $current_oid, '-Oqv', '') / $precision);
|
||||
$limit = (snmp_get($device, $limit_oid, '-Oqv', '') / $voltage);
|
||||
$lowlimit = (snmp_get($device, $lowlimit_oid, '-Oqv', '') / $voltage);
|
||||
$warnlimit = (snmp_get($device, $warnlimit_oid, '-Oqv', '') / $voltage);
|
||||
$descr = 'Outlet '.$index.' - '.snmp_get($device, $name_oid, '-Oqv', '');
|
||||
|
||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($oids);
|
||||
|
||||
// ATS
|
||||
$oids = snmp_walk($device, 'atsConfigPhaseTableIndex', '-OsqnU', 'PowerNet-MIB');
|
||||
if ($oids) {
|
||||
$type = 'apc';
|
||||
d_echo($oids."\n");
|
||||
|
||||
$oids = trim($oids);
|
||||
if ($oids) {
|
||||
echo 'APC PowerNet-MIB ATS ';
|
||||
}
|
||||
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1';
|
||||
// atsOutputCurrent
|
||||
$limit_oid = '.1.3.6.1.4.1.318.1.1.8.4.16.1.5.1';
|
||||
@@ -189,7 +160,6 @@ if ($oids) {
|
||||
$warnlimit_oid = '.1.3.6.1.4.1.318.1.1.8.4.16.1.4.1';
|
||||
// atsConfigPhaseNearOverLoadThreshold
|
||||
$index = 1;
|
||||
|
||||
$current = (snmp_get($device, $current_oid, '-Oqv', '') / $precision);
|
||||
$limit = snmp_get($device, $limit_oid, '-Oqv', '');
|
||||
// No / $precision here! Nice, APC!
|
||||
@@ -198,46 +168,52 @@ if ($oids) {
|
||||
$warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', '');
|
||||
// No / $precision here! Nice, APC!
|
||||
$descr = 'Output Feed';
|
||||
|
||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||
}
|
||||
|
||||
unset($oids);
|
||||
|
||||
// UPS
|
||||
$oid_array = array(
|
||||
array(
|
||||
'HighPrecOid' => 'upsHighPrecOutputCurrent',
|
||||
'AdvOid' => 'upsAdvOutputCurrent',
|
||||
'type' => 'apc',
|
||||
'index' => 0,
|
||||
'descr' => 'Current Drawn',
|
||||
'divisor' => 10,
|
||||
'mib' => '+PowerNet-MIB',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($oid_array as $item) {
|
||||
$oids = snmp_get($device, $item['HighPrecOid'].'.'.$item['index'], '-OsqnU', $item['mib']);
|
||||
if (empty($oids)) {
|
||||
$oids = snmp_get($device, $item['AdvOid'].'.'.$item['index'], '-OsqnU', $item['mib']);
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.4.2.4';
|
||||
$current = $oids;
|
||||
$item['divisor'] = 1;
|
||||
} else {
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.4.3.4';
|
||||
$value = explode(" ", $oids);
|
||||
$current = $value[1]/$item['divisor'];
|
||||
}
|
||||
|
||||
if (!empty($oids)) {
|
||||
d_echo($oids."\n");
|
||||
|
||||
$oids = trim($oids);
|
||||
if ($oids) {
|
||||
echo $item['type'].' '.$item['mib'].' UPS';
|
||||
$phasecount = $phasecount = $pre_cache['apcups_phase_count'];
|
||||
if ($phasecount > 1) {
|
||||
$oids = snmpwalk_cache_oid($device, 'upsPhaseOutputCurrent', $oids, 'PowerNet-MIB');
|
||||
$in_oids = snmpwalk_cache_oid($device, 'upsPhaseInputCurrent', $in_oids, 'PowerNet-MIB');
|
||||
} else {
|
||||
$oids = snmpwalk_cache_oid($device, 'upsHighPrecOutputCurrent', $oids, 'PowerNet-MIB');
|
||||
}
|
||||
if (isset($in_oids)) {
|
||||
foreach ($in_oids as $index => $data) {
|
||||
$type = 'apcUPS';
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.9.2.3.1.6.' . $index;
|
||||
$divisor = 10;
|
||||
$current = $data['upsPhaseInputCurrent'] / $divisor;
|
||||
$in_index = '3.1.4.' . $index;
|
||||
if (substr($index, 0, 1) == 2 && $data['upsPhaseInputCurrent'] != -1) {
|
||||
$descr = 'Phase ' . substr($index, -1) . ' Bypass Input';
|
||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $in_index, $type, $descr, $divisor, 0, null, null, null, null, $current);
|
||||
} elseif (substr($index, 0, 1) == 1) {
|
||||
$descr = 'Phase ' . substr($index, -1) . ' Input';
|
||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $in_index, $type, $descr, $divisor, 0, null, null, null, null, $current);
|
||||
}
|
||||
|
||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid.'.'.$item['index'], $current_oid.'.'.$item['index'], $item['type'], $item['descr'], $item['divisor'], 1, null, null, null, null, $current);
|
||||
}
|
||||
}
|
||||
unset($index);
|
||||
unset($data);
|
||||
foreach ($oids as $index => $data) {
|
||||
$type = 'apcUPS';
|
||||
$descr = 'Phase ' . substr($index, -1) . ' Output';
|
||||
if (isset($data['upsHighPrecOutputCurrent'])) {
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.4.3.4.' . $index;
|
||||
$divisor = 10;
|
||||
$current = $data['upsHighPrecOutputCurrent'] / $divisor;
|
||||
} else {
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.9.3.3.1.4.' . $index;
|
||||
$divisor = 10;
|
||||
$current = $data['upsPhaseOutputCurrent'] / $divisor;
|
||||
}
|
||||
if ($current >= -1) {
|
||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, 1, null, null, null, null, $current);
|
||||
}
|
||||
}
|
||||
unset($index);
|
||||
unset($data);
|
||||
|
||||
@@ -2,7 +2,23 @@
|
||||
|
||||
echo 'APC Load ';
|
||||
|
||||
$oid_array = array(
|
||||
$phasecount = $phasecount = $pre_cache['apcups_phase_count'];
|
||||
if ($phasecount > 1) {
|
||||
$oids = snmpwalk_cache_oid($device, 'upsPhaseOutputPercentLoad', array(), 'PowerNet-MIB');
|
||||
d_echo($oids);
|
||||
foreach ($oids as $index => $data) {
|
||||
$type = 'apcUPS';
|
||||
$descr = 'Phase ' . substr($index, -1);
|
||||
$load_oid = '.1.3.6.1.4.1.318.1.1.1.9.3.3.1.10.' . $index;
|
||||
$divisor = 1;
|
||||
$load = $data['upsPhaseOutputPercentLoad'];
|
||||
if ($load >= 0) {
|
||||
discover_sensor($valid['sensor'], 'load', $device, $load_oid, $index, $type, $descr, $divisor, 1, null, null, null, null, $load);
|
||||
}
|
||||
}
|
||||
unset($oids);
|
||||
} else {
|
||||
$oid_array = array(
|
||||
array(
|
||||
'HighPrecOid' => 'upsHighPrecOutputLoad',
|
||||
'AdvOid' => 'upsAdvOutputLoad',
|
||||
@@ -12,29 +28,26 @@ $oid_array = array(
|
||||
'divisor' => 10,
|
||||
'mib' => '+PowerNet-MIB',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($oid_array as $item) {
|
||||
$oids = snmp_get($device, $item['HighPrecOid'].'.'.$item['index'], '-OsqnU', $item['mib']);
|
||||
if (empty($oids)) {
|
||||
$oids = snmp_get($device, $item['AdvOid'].'.'.$item['index'], '-OsqnU', $item['mib']);
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.4.3.3';
|
||||
$current = $oids;
|
||||
$item['divisor'] = 1;
|
||||
} else {
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.4.3.3';
|
||||
$value = explode(" ", $oids);
|
||||
$current = $value[1]/$item['divisor'];
|
||||
}
|
||||
|
||||
if (!empty($oids)) {
|
||||
d_echo($oids);
|
||||
|
||||
$oids = trim($oids);
|
||||
if ($oids) {
|
||||
echo $item['type'].' '.$item['mib'].' UPS';
|
||||
);
|
||||
foreach ($oid_array as $item) {
|
||||
$oids = snmp_get($device, $item['HighPrecOid'].'.'.$item['index'], '-OsqnU', $item['mib']);
|
||||
if (empty($oids)) {
|
||||
$oids = snmp_get($device, $item['AdvOid'].'.'.$item['index'], '-OsqnU', $item['mib']);
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.4.3.3';
|
||||
$current = $oids;
|
||||
$item['divisor'] = 1;
|
||||
} else {
|
||||
$current_oid = '.1.3.6.1.4.1.318.1.1.1.4.3.3';
|
||||
$value = explode(" ", $oids);
|
||||
$current = $value[1]/$item['divisor'];
|
||||
}
|
||||
|
||||
discover_sensor($valid['sensor'], 'load', $device, $current_oid.'.'.$item['index'], $current_oid.'.'.$item['index'], $item['type'], $item['descr'], $item['divisor'], 1, null, null, null, null, $current);
|
||||
}
|
||||
}//end foreach
|
||||
if (!empty($oids)) {
|
||||
d_echo($oids);
|
||||
$oids = trim($oids);
|
||||
if ($oids) {
|
||||
echo $item['type'].' '.$item['mib'].' UPS';
|
||||
}
|
||||
discover_sensor($valid['sensor'], 'load', $device, $current_oid.'.'.$item['index'], $current_oid.'.'.$item['index'], $item['type'], $item['descr'], $item['divisor'], 1, null, null, null, null, $current);
|
||||
}
|
||||
}//end foreach
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
* @copyright 2016 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
echo 'coolingUnitStatusAnalogEntry ';
|
||||
$pre_cache['cooling_unit_analog'] = snmpwalk_cache_oid($device, 'coolingUnitStatusAnalogEntry', array(), 'PowerNet-MIB');
|
||||
|
||||
echo 'upsPhaseNumInputPhases';
|
||||
$pre_cache['apcups_phase_count'] = snmp_get($device, 'upsPhaseNumInputPhases.1', '-OQv', 'PowerNet-MIB');
|
||||
|
||||
@@ -1,107 +1,142 @@
|
||||
<?php
|
||||
|
||||
$oids = snmp_walk($device, '.1.3.6.1.4.1.318.1.1.8.5.3.3.1.3', '-OsqnU');
|
||||
// Battery Bus Voltage
|
||||
|
||||
$oids = snmp_get($device, '.1.3.6.1.4.1.318.1.1.1.2.2.8.0', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
|
||||
if ($oids) {
|
||||
echo 'APC In ';
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid, $current) = explode(' ', $data, 2);
|
||||
$split_oid = explode('.', $oid);
|
||||
$index = $split_oid[(count($split_oid) - 3)];
|
||||
$oid = '.1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.' . $index . '.1.1';
|
||||
$descr = 'Input Feed ' . chr(64 + $index);
|
||||
echo ' Battery Bus ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
$index = '2.2.8.0';
|
||||
$descr = 'Battery Bus';
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
unset($oids);
|
||||
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, "3.3.1.3.$index", $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
//Three Phase Detection & Support
|
||||
|
||||
$phasecount = $pre_cache['apcups_phase_count'];
|
||||
d_echo($phasecount);
|
||||
d_echo($pre_cache['apcups_phase_count']);
|
||||
// Check for three phase UPS devices - else skip to normal discovery
|
||||
if ($phasecount > 1) {
|
||||
$oids = snmpwalk_cache_oid($device, 'upsPhaseOutputVoltage', $oids, 'PowerNet-MIB');
|
||||
$in_oids = snmpwalk_cache_oid($device, 'upsPhaseInputVoltage', $in_oids, 'PowerNet-MIB');
|
||||
foreach ($oids as $index => $data) {
|
||||
$type = 'apcUPS';
|
||||
$descr = 'Phase ' . substr($index, -1) . ' Output';
|
||||
$voltage_oid = '.1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.' . $index;
|
||||
$divisor = 1;
|
||||
$voltage = $data['upsPhaseOutputVoltage'] / $divisor;
|
||||
if ($voltage >= 0) {
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $voltage_oid, $index, $type, $descr, $divisor, 1, null, null, null, null, $voltage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oids = snmp_walk($device, '.1.3.6.1.4.1.318.1.1.8.5.4.3.1.3', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
|
||||
if ($oids) {
|
||||
echo ' APC Out ';
|
||||
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid, $current) = explode(' ', $data, 2);
|
||||
$split_oid = explode('.', $oid);
|
||||
$index = $split_oid[(count($split_oid) - 3)];
|
||||
$oid = '.1.3.6.1.4.1.318.1.1.8.5.4.3.1.3.' . $index . '.1.1';
|
||||
$descr = 'Output Feed';
|
||||
if (count(explode("\n", $oids)) > 1) {
|
||||
$descr .= " $index";
|
||||
unset($index);
|
||||
unset($data);
|
||||
foreach ($in_oids as $index => $data) {
|
||||
$type = 'apcUPS';
|
||||
$voltage_oid = '.1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.' . $index;
|
||||
$divisor = 1;
|
||||
$voltage = $data['upsPhaseInputVoltage'] / $divisor;
|
||||
$in_index = '3.1.3.' . $index;
|
||||
if (substr($index, 0, 1) == 2 && $data['upsPhaseInputVoltage'] != -1) {
|
||||
$descr = 'Phase ' . substr($index, -1) . ' Bypass Input';
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $voltage_oid, $in_index, $type, $descr, $divisor, 0, null, null, null, null, $voltage);
|
||||
} elseif (substr($index, 0, 1) == 1) {
|
||||
$descr = 'Phase ' . substr($index, -1) . ' Input';
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $voltage_oid, $in_index, $type, $descr, $divisor, 0, null, null, null, null, $voltage);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$oids = snmp_walk($device, '.1.3.6.1.4.1.318.1.1.8.5.3.3.1.3', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
if ($oids) {
|
||||
echo 'APC In ';
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid, $current) = explode(' ', $data, 2);
|
||||
$split_oid = explode('.', $oid);
|
||||
$index = $split_oid[(count($split_oid) - 3)];
|
||||
$oid = '.1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.' . $index . '.1.1';
|
||||
$descr = 'Input Feed ' . chr(64 + $index);
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, "3.3.1.3.$index", $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, "4.3.1.3.$index", $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oids = snmp_get($device, '.1.3.6.1.4.1.318.1.1.1.3.2.1.0', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
|
||||
if ($oids) {
|
||||
echo ' APC In ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
$index = '3.2.1.0';
|
||||
$descr = 'Input';
|
||||
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
|
||||
$oids = snmp_get($device, '.1.3.6.1.4.1.318.1.1.1.4.2.1.0', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
|
||||
if ($oids) {
|
||||
echo ' APC Out ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
$index = '4.2.1.0';
|
||||
$descr = 'Output';
|
||||
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
|
||||
// rPDUIdentDeviceLinetoLineVoltage
|
||||
$oids = snmp_get($device, ".1.3.6.1.4.1.318.1.1.12.1.15.0", "-OsqnU");
|
||||
d_echo($oids."\n");
|
||||
|
||||
if ($oids) {
|
||||
echo ' Voltage In ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
if ($current >= 0) { // Newer units using rPDU2 can return the following rPDUIdentDeviceLinetoLineVoltage.0; Value (Integer): -1 hence this check.
|
||||
$oids = snmp_walk($device, '.1.3.6.1.4.1.318.1.1.8.5.4.3.1.3', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
if ($oids) {
|
||||
echo ' APC Out ';
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid, $current) = explode(' ', $data, 2);
|
||||
$split_oid = explode('.', $oid);
|
||||
$index = $split_oid[(count($split_oid) - 3)];
|
||||
$oid = '.1.3.6.1.4.1.318.1.1.8.5.4.3.1.3.' . $index . '.1.1';
|
||||
$descr = 'Output Feed';
|
||||
if (count(explode("\n", $oids)) > 1) {
|
||||
$descr .= " $index";
|
||||
}
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, "4.3.1.3.$index", $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
$oids = snmp_get($device, '.1.3.6.1.4.1.318.1.1.1.3.2.1.0', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
if ($oids) {
|
||||
echo ' APC In ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
$index = '3.2.1.0';
|
||||
$descr = 'Input';
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
$oids = snmp_get($device, '.1.3.6.1.4.1.318.1.1.1.4.2.1.0', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
if ($oids) {
|
||||
echo ' APC Out ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
$index = '4.2.1.0';
|
||||
$descr = 'Output';
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
// rPDUIdentDeviceLinetoLineVoltage
|
||||
$oids = snmp_get($device, ".1.3.6.1.4.1.318.1.1.12.1.15.0", "-OsqnU");
|
||||
d_echo($oids."\n");
|
||||
if ($oids) {
|
||||
echo ' Voltage In ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
if ($current >= 0) { // Newer units using rPDU2 can return the following rPDUIdentDeviceLinetoLineVoltage.0; Value (Integer): -1 hence this check.
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
$index = '1';
|
||||
$descr = 'Input';
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
}
|
||||
// rPDU2PhaseStatusVoltage
|
||||
$oids = snmp_walk($device, '.1.3.6.1.4.1.318.1.1.26.6.3.1.6', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
if ($oids) {
|
||||
echo ' Voltage In ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
$index = '1';
|
||||
$descr = 'Input';
|
||||
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
}
|
||||
|
||||
// rPDU2PhaseStatusVoltage
|
||||
$oids = snmp_walk($device, '.1.3.6.1.4.1.318.1.1.26.6.3.1.6', '-OsqnU');
|
||||
d_echo($oids."\n");
|
||||
|
||||
if ($oids) {
|
||||
echo ' Voltage In ';
|
||||
list($oid,$current) = explode(' ', $oids);
|
||||
$divisor = 1;
|
||||
$type = 'apc';
|
||||
$index = '1';
|
||||
$descr = 'Input';
|
||||
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user