mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
PSR2 Cleanup: /html edition
Travis tests for code conformance. Ignore warnings for now. Fixed all errors, left most warnings.
This commit is contained in:
@@ -15,7 +15,7 @@ require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options = array();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
$components = $component->getComponents($device['device_id'], $options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
@@ -23,7 +23,7 @@ $components = $components[$device['device_id']];
|
||||
// Determine a policy to show.
|
||||
if (!isset($vars['policy'])) {
|
||||
foreach ($components as $id => $array) {
|
||||
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
|
||||
if (($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0)) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $id;
|
||||
continue;
|
||||
@@ -36,7 +36,7 @@ $rrd_options .= " -l 0 -E ";
|
||||
$rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$colours = array_merge($config['graph_colours']['mixed'],$config['graph_colours']['manycolours'],$config['graph_colours']['manycolours']);
|
||||
$colours = array_merge($config['graph_colours']['mixed'], $config['graph_colours']['manycolours'], $config['graph_colours']['manycolours']);
|
||||
$count = 0;
|
||||
|
||||
d_echo("<pre>Policy: ".$vars['policy']);
|
||||
@@ -45,15 +45,14 @@ foreach ($components as $id => $array) {
|
||||
$addtograph = false;
|
||||
|
||||
// We only care about children of the selected policy.
|
||||
if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) {
|
||||
if (($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) {
|
||||
// Are we trying to only graph a single class?
|
||||
if (isset($vars['class'])) {
|
||||
// Yes, is this the selected class
|
||||
if ($vars['class'] == $id) {
|
||||
$addtograph = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// No, Graph everything
|
||||
$addtograph = true;
|
||||
}
|
||||
@@ -71,24 +70,22 @@ foreach ($components as $id => $array) {
|
||||
}
|
||||
|
||||
// Grab a colour from the array.
|
||||
if ( isset($colours[$count]) ) {
|
||||
if (isset($colours[$count])) {
|
||||
$colour = $colours[$count];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
d_echo("\nError: Out of colours. Have: ".(count($colours)-1).", Requesting:".$count);
|
||||
}
|
||||
|
||||
$rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":qosdrops:AVERAGE ";
|
||||
$rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* ";
|
||||
$rrd_additions .= " AREA:MOD" . $count . "#" . $colour . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack;
|
||||
$rrd_additions .= " AREA:MOD" . $count . "#" . $colour . ":'" . str_pad(substr($components[$id]['label'], 0, 15), 15) . "'" . $stack;
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l ";
|
||||
|
||||
$count++;
|
||||
} // End if file exists
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
d_echo("\n Class: ".$components[$id]['label']."\t- NOT added to the graph");
|
||||
} // End if addtograph
|
||||
}
|
||||
@@ -98,7 +95,6 @@ d_echo("</pre>");
|
||||
if ($rrd_additions == "") {
|
||||
// We didn't add any data points.
|
||||
d_echo("<pre>No DS to add</pre>");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$rrd_options .= $rrd_additions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user