2010-08-02 23:11:54 +00:00
|
|
|
<?php
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$cpe_oids = array(
|
|
|
|
'cpeExtPsePortEnable',
|
|
|
|
'cpeExtPsePortDiscoverMode',
|
|
|
|
'cpeExtPsePortDeviceDetected',
|
|
|
|
'cpeExtPsePortIeeePd',
|
|
|
|
'cpeExtPsePortAdditionalStatus',
|
|
|
|
'cpeExtPsePortPwrMax',
|
|
|
|
'cpeExtPsePortPwrAllocated',
|
|
|
|
'cpeExtPsePortPwrAvailable',
|
|
|
|
'cpeExtPsePortPwrConsumption',
|
|
|
|
'cpeExtPsePortMaxPwrDrawn',
|
|
|
|
'cpeExtPsePortEntPhyIndex',
|
|
|
|
'cpeExtPsePortEntPhyIndex',
|
|
|
|
'cpeExtPsePortPolicingCapable',
|
|
|
|
'cpeExtPsePortPolicingEnable',
|
|
|
|
'cpeExtPsePortPolicingAction',
|
|
|
|
'cpeExtPsePortPwrManAlloc',
|
|
|
|
);
|
2010-08-02 23:11:54 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$peth_oids = array(
|
|
|
|
'pethPsePortAdminEnable',
|
|
|
|
'pethPsePortPowerPairsControlAbility',
|
|
|
|
'pethPsePortPowerPairs',
|
|
|
|
'pethPsePortDetectionStatus',
|
|
|
|
'pethPsePortPowerPriority',
|
|
|
|
'pethPsePortMPSAbsentCounter',
|
|
|
|
'pethPsePortType',
|
|
|
|
'pethPsePortPowerClassifications',
|
|
|
|
'pethPsePortInvalidSignatureCounter',
|
|
|
|
'pethPsePortPowerDeniedCounter',
|
|
|
|
'pethPsePortOverLoadCounter',
|
|
|
|
'pethPsePortShortCounter',
|
|
|
|
'pethMainPseConsumptionPower',
|
|
|
|
);
|
2010-08-02 23:11:54 +00:00
|
|
|
|
2016-01-26 13:49:30 +01:00
|
|
|
if ($port_stats[$port_id]
|
2015-07-13 20:10:26 +02:00
|
|
|
&& $port['ifType'] == 'ethernetCsmacd'
|
2016-01-26 13:49:30 +01:00
|
|
|
&& isset($port_stats[$port_id]['dot3StatsIndex'])) {
|
2015-07-13 20:10:26 +02:00
|
|
|
// Check to make sure Port data is cached.
|
2016-01-26 13:49:30 +01:00
|
|
|
$this_port = &$port_stats[$port_id];
|
2010-08-02 23:11:54 +00:00
|
|
|
|
2016-01-26 13:49:30 +01:00
|
|
|
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id, 'poe');
|
2015-07-13 20:10:26 +02:00
|
|
|
if (!file_exists($rrdfile)) {
|
|
|
|
$rrd_create .= $config['rrd_rra'];
|
2010-08-02 23:11:54 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
// 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 ';
|
2010-08-02 23:11:54 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
rrdtool_create($rrdfile, $rrd_create);
|
2010-08-02 23:11:54 +00:00
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$upd = "$polled:".$port['cpeExtPsePortPwrAllocated'].':'.$port['cpeExtPsePortPwrAvailable'].':'.$port['cpeExtPsePortPwrConsumption'].':'.$port['cpeExtPsePortMaxPwrDrawn'];
|
2015-08-18 16:26:55 +00:00
|
|
|
|
|
|
|
$fields = array(
|
|
|
|
'PortPwrAllocated' => $port['cpeExtPsePortPwrAllocated'],
|
|
|
|
'PortPwrAvailable' => $port['cpeExtPsePortPwrAvailable'],
|
|
|
|
'PortConsumption' => $port['cpeExtPsePortPwrConsumption'],
|
|
|
|
'PortMaxPwrDrawn' => $port['cpeExtPsePortMaxPwrDrawn'],
|
|
|
|
);
|
|
|
|
|
|
|
|
$ret = rrdtool_update("$rrdfile", $fields);
|
2010-08-02 23:11:54 +00:00
|
|
|
|
2015-08-19 20:58:02 +00:00
|
|
|
$tags = array('ifName' => $port['ifName']);
|
|
|
|
influx_update($device,'poe',$tags,$fields);
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
echo 'PoE ';
|
|
|
|
}//end if
|