librenms/includes/polling/port-poe.inc.php
Tony Murray 9284bc60ff Update code in includes to be PSR-2 compliant (#4220)
refactor: Update code in /includes to be psr2 compliant #4220
2016-08-28 18:32:58 +01:00

61 lines
1.9 KiB
PHP

<?php
$cpe_oids = array(
'cpeExtPsePortEnable',
'cpeExtPsePortDiscoverMode',
'cpeExtPsePortDeviceDetected',
'cpeExtPsePortIeeePd',
'cpeExtPsePortAdditionalStatus',
'cpeExtPsePortPwrMax',
'cpeExtPsePortPwrAllocated',
'cpeExtPsePortPwrAvailable',
'cpeExtPsePortPwrConsumption',
'cpeExtPsePortMaxPwrDrawn',
'cpeExtPsePortEntPhyIndex',
'cpeExtPsePortEntPhyIndex',
'cpeExtPsePortPolicingCapable',
'cpeExtPsePortPolicingEnable',
'cpeExtPsePortPolicingAction',
'cpeExtPsePortPwrManAlloc',
);
$peth_oids = array(
'pethPsePortAdminEnable',
'pethPsePortPowerPairsControlAbility',
'pethPsePortPowerPairs',
'pethPsePortDetectionStatus',
'pethPsePortPowerPriority',
'pethPsePortMPSAbsentCounter',
'pethPsePortType',
'pethPsePortPowerClassifications',
'pethPsePortInvalidSignatureCounter',
'pethPsePortPowerDeniedCounter',
'pethPsePortOverLoadCounter',
'pethPsePortShortCounter',
'pethMainPseConsumptionPower',
);
if ($this_port['dot3StatsIndex'] && $port['ifType'] == 'ethernetCsmacd') {
$rrd_name = getPortRrdName($port_id, 'poe');
$rrd_def = array(
'DS:PortPwrAllocated:GAUGE:600:0:U',
'DS:PortPwrAvailable:GAUGE:600:0:U',
'DS:PortConsumption:DERIVE:600:0:U',
'DS:PortMaxPwrDrawn:GAUGE:600:0:U'
);
$upd = "$polled:".$port['cpeExtPsePortPwrAllocated'].':'.$port['cpeExtPsePortPwrAvailable'].':'.$port['cpeExtPsePortPwrConsumption'].':'.$port['cpeExtPsePortMaxPwrDrawn'];
$fields = array(
'PortPwrAllocated' => $port['cpeExtPsePortPwrAllocated'],
'PortPwrAvailable' => $port['cpeExtPsePortPwrAvailable'],
'PortConsumption' => $port['cpeExtPsePortPwrConsumption'],
'PortMaxPwrDrawn' => $port['cpeExtPsePortMaxPwrDrawn'],
);
$tags = compact('ifName', 'rrd_name', 'rrd_def');
data_update($device, 'poe', $tags, $fields);
echo 'PoE ';
}//end if