Files
librenms-librenms/includes/discovery/load/apc.inc.php

52 lines
1.6 KiB
PHP
Raw Normal View History

2015-04-30 19:04:06 +01:00
<?php
// APC
2015-07-13 20:10:26 +02:00
if ($device['os'] == 'apc') {
echo 'APC Load ';
// UPS
2015-04-30 19:04:06 +01:00
$oid_array = array(
2015-07-13 20:10:26 +02:00
array(
'HighPrecOid' => 'upsHighPrecOutputLoad',
'AdvOid' => 'upsAdvOutputLoad',
'type' => 'apc',
'index' => 0,
'descr' => 'Load',
'divisor' => 10,
'mib' => '+PowerNet-MIB',
),
2015-04-30 19:04:06 +01:00
);
foreach ($oid_array as $item) {
2015-07-13 20:10:26 +02:00
$low_limit = null;
$low_limit_warn = null;
$warn_limit = null;
$high_limit = null;
$oids = snmp_get($device, $item['HighPrecOid'].'.'.$item['index'], '-OsqnU', $item['mib']);
2015-04-30 19:04:06 +01:00
if (empty($oids)) {
2015-07-13 20:10:26 +02:00
$oids = snmp_get($device, $item['AdvOid'].'.'.$item['index'], '-OsqnU', $item['mib']);
2015-04-30 19:04:06 +01:00
$current_oid = $item['AdvOid'];
2015-07-13 20:10:26 +02:00
}
else {
2015-04-30 19:04:06 +01:00
$current_oid = $item['HighPrecOid'];
}
2015-07-13 20:10:26 +02:00
2015-04-30 19:04:06 +01:00
if (!empty($oids)) {
d_echo($oids);
2015-07-13 20:10:26 +02:00
2015-04-30 19:04:06 +01:00
$oids = trim($oids);
if ($oids) {
2015-07-13 20:10:26 +02:00
echo $item['type'].' '.$item['mib'].' UPS';
2015-04-30 19:04:06 +01:00
}
2015-07-13 20:10:26 +02:00
if (stristr($current_oid, 'HighPrec')) {
$current = ($oids / $item['divisor']);
}
else {
$current = $oids;
2015-04-30 19:04:06 +01:00
$item['divisor'] = 1;
}
2015-07-13 20:10:26 +02:00
2015-04-30 19:04:06 +01:00
discover_sensor($valid['sensor'], 'load', $device, $current_oid.'.'.$item['index'], $current_oid.'.'.$item['index'], $item['type'], $item['descr'], $item['divisor'], 1, $low_limit, $low_limit_warn, $warn_limit, $high_limit, $current);
}
2015-07-13 20:10:26 +02:00
}//end foreach
}//end if