Maximilian Wilhelm ec5d0dfd89 Remove redundant code from port-{adsl,etherlike,poe} polling submodules.
$this_port already gets defined within include/polling/ports.inc.php
  so there's no need to redefine it again in each submodule.

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
2016-02-03 21:14:25 +01:00

68 lines
2.2 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') {
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id, 'poe');
if (!file_exists($rrdfile)) {
$rrd_create .= $config['rrd_rra'];
// FIXME CISCOSPECIFIC
$rrd_create .= ' DS:PortPwrAllocated:GAUGE:600:0:U';
$rrd_create .= ' DS:PortPwrAvailable:GAUGE:600:0:U';
$rrd_create .= ' DS:PortConsumption:DERIVE:600:0:U';
$rrd_create .= ' DS:PortMaxPwrDrawn:GAUGE:600:0:U ';
rrdtool_create($rrdfile, $rrd_create);
}
$upd = "$polled:".$port['cpeExtPsePortPwrAllocated'].':'.$port['cpeExtPsePortPwrAvailable'].':'.$port['cpeExtPsePortPwrConsumption'].':'.$port['cpeExtPsePortMaxPwrDrawn'];
$fields = array(
'PortPwrAllocated' => $port['cpeExtPsePortPwrAllocated'],
'PortPwrAvailable' => $port['cpeExtPsePortPwrAvailable'],
'PortConsumption' => $port['cpeExtPsePortPwrConsumption'],
'PortMaxPwrDrawn' => $port['cpeExtPsePortMaxPwrDrawn'],
);
$ret = rrdtool_update("$rrdfile", $fields);
$tags = array('ifName' => $port['ifName']);
influx_update($device,'poe',$tags,$fields);
echo 'PoE ';
}//end if