librenms-librenms/includes/polling/port-etherlike.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

25 lines
753 B
PHP

<?php
if ($this_port['dot3StatsIndex'] and $port['ifType'] == 'ethernetCsmacd') {
$rrd_oldname= 'etherlike-'.$port['ifIndex']; // TODO: remove oldname check?
$rrd_name = getPortRrdName($port_id, 'dot3');
$rrd_def = array();
$rrd_create = $config['rrd_rra'];
foreach ($etherlike_oids as $oid) {
$oid = truncate(str_replace('dot3Stats', '', $oid), 19, '');
$rrd_def[] = "DS:$oid:COUNTER:600:U:100000000000";
}
$fields = array();
foreach ($etherlike_oids as $oid) {
$data = ($this_port[$oid] + 0);
$fields[$oid] = $data;
}
$tags = compact('ifName', 'rrd_name', 'rrd_def', 'rrd_oldname');
data_update($device, 'dot3', $tags, $fields);
echo 'EtherLike ';
}