mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Fix coding style part 2
This commit is contained in:
@@ -1,42 +1,37 @@
|
||||
<?php
|
||||
|
||||
if ($port_stats[$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
&& isset($port_stats[$port['ifIndex']]['dot3StatsIndex']))
|
||||
{ // Check to make sure Port data is cached.
|
||||
if ($port_stats[$port['ifIndex']] &&
|
||||
$port['ifType'] == 'ethernetCsmacd' &&
|
||||
isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port[ifIndex]];
|
||||
|
||||
$this_port = &$port_stats[$port[ifIndex]];
|
||||
$old_rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('etherlike-'.$port['ifIndex'].'.rrd');
|
||||
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-dot3.rrd');
|
||||
|
||||
$old_rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("etherlike-".$port['ifIndex'].".rrd");
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("port-".$port['ifIndex']."-dot3.rrd");
|
||||
$rrd_create = $config['rrd_rra'];
|
||||
|
||||
$rrd_create = $config['rrd_rra'];
|
||||
if (!file_exists($rrdfile)) {
|
||||
if (file_exists($old_rrdfile)) {
|
||||
rename($old_rrdfile, $rrd_file);
|
||||
}
|
||||
else {
|
||||
foreach ($etherlike_oids as $oid) {
|
||||
$oid = truncate(str_replace('dot3Stats', '', $oid), 19, '');
|
||||
$rrd_create .= " DS:$oid:COUNTER:600:U:100000000000";
|
||||
}
|
||||
|
||||
if (!file_exists($rrdfile))
|
||||
{
|
||||
if (file_exists($old_rrdfile))
|
||||
{
|
||||
rename($old_rrdfile,$rrd_file);
|
||||
rrdtool_create($rrdfile, $rrd_create);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($etherlike_oids as $oid)
|
||||
{
|
||||
$oid = truncate(str_replace("dot3Stats", "", $oid), 19, '');
|
||||
$rrd_create .= " DS:$oid:COUNTER:600:U:100000000000";
|
||||
}
|
||||
rrdtool_create($rrdfile, $rrd_create);
|
||||
|
||||
$rrdupdate = 'N';
|
||||
foreach ($etherlike_oids as $oid) {
|
||||
$data = ($this_port[$oid] + 0);
|
||||
$rrdupdate .= ":$data";
|
||||
}
|
||||
}
|
||||
|
||||
$rrdupdate = "N";
|
||||
foreach ($etherlike_oids as $oid)
|
||||
{
|
||||
$data = $this_port[$oid] + 0;
|
||||
$rrdupdate .= ":$data";
|
||||
}
|
||||
rrdtool_update($rrdfile, $rrdupdate);
|
||||
rrdtool_update($rrdfile, $rrdupdate);
|
||||
|
||||
echo("EtherLike ");
|
||||
echo 'EtherLike ';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user