Apply fixes from StyleCI (#12120)

This commit is contained in:
Jellyfrog
2020-09-21 15:40:17 +02:00
committed by GitHub
parent 77c531527c
commit 82f43cb98d
1733 changed files with 18337 additions and 18540 deletions

View File

@@ -7,7 +7,7 @@ foreach (dbFetchRows('SELECT * FROM `ports` AS P, `devices` AS D WHERE D.device_
$ignore = 0;
if (is_array(\LibreNMS\Config::get('device_traffic_iftype'))) {
foreach (\LibreNMS\Config::get('device_traffic_iftype') as $iftype) {
if (preg_match($iftype.'i', $port['ifType'])) {
if (preg_match($iftype . 'i', $port['ifType'])) {
$ignore = 1;
}
}
@@ -15,19 +15,19 @@ foreach (dbFetchRows('SELECT * FROM `ports` AS P, `devices` AS D WHERE D.device_
if (is_array(\LibreNMS\Config::get('device_traffic_descr'))) {
foreach (\LibreNMS\Config::get('device_traffic_descr') as $ifdescr) {
if (preg_match($ifdescr.'i', $port['ifDescr']) || preg_match($ifdescr.'i', $port['ifName'])) {
if (preg_match($ifdescr . 'i', $port['ifDescr']) || preg_match($ifdescr . 'i', $port['ifName'])) {
$ignore = 1;
}
}
}
$rrd_filename = get_port_rrdfile_path($port['hostname'], $port['port_id']);
if (!$ignore && $i < 1100 && rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_filenames[] = $rrd_filename;
if (! $ignore && $i < 1100 && rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_filenames[] = $rrd_filename;
$rrd_list[$i]['filename'] = $rrd_filename;
// $rrd_list[$i]['descr'] = $port['device_id'] . " " . $port['ifDescr'];
$rrd_list[$i]['descr'] = 'dev'.$port['device_id'].'if'.$port['ifIndex'];
$rrd_list[$i]['rra_in'] = $rra_in;
$rrd_list[$i]['descr'] = 'dev' . $port['device_id'] . 'if' . $port['ifIndex'];
$rrd_list[$i]['rra_in'] = $rra_in;
$rrd_list[$i]['rra_out'] = $rra_out;
$i++;
}
@@ -35,22 +35,22 @@ foreach (dbFetchRows('SELECT * FROM `ports` AS P, `devices` AS D WHERE D.device_
unset($ignore);
}//end foreach
$units = 'bps';
$units = 'bps';
$total_units = 'B';
$colours_in = 'greens';
$multiplier = '8';
$colours_in = 'greens';
$multiplier = '8';
$colours_out = 'blues';
$nototal = 1;
$ds_in = 'INOCTETS';
$ds_in = 'INOCTETS';
$ds_out = 'OUTOCTETS';
$graph_title .= '::bits';
$colour_line_in = '006600';
$colour_line_in = '006600';
$colour_line_out = '000099';
$colour_area_in = 'CDEB8B';
$colour_area_in = 'CDEB8B';
$colour_area_out = 'C3D9FF';
require 'includes/html/graphs/generic_multi_bits_separated.inc.php';

View File

@@ -40,7 +40,7 @@ foreach ($modules as $module_index => $module) {
$suffix = '';
$cdefX = [];
$suffixX = '';
foreach ($hostnames as $index => $hostname) {
$rrd_filename = rrd_name($hostname, ['poller-perf', $module]);
if (rrdtool_check_rrd_exists($rrd_filename)) {
@@ -83,12 +83,12 @@ $rrd_options .= " COMMENT:'\\n'";
foreach ($modules as $index => $module) {
$color = $colors[$index % count($colors)];
$rrd_options .= " AREA:$module#$color:'" . rrdtool_escape($module, 16) ."':STACK";
$rrd_options .= " AREA:$module#$color:'" . rrdtool_escape($module, 16) . "':STACK";
$rrd_options .= " GPRINT:$module:LAST:%6.2lf GPRINT:$module:MIN:%6.2lf";
$rrd_options .= " GPRINT:$module:MAX:%6.2lf 'GPRINT:$module:AVERAGE:%6.2lf'";
if ($_GET['previous']) {
$rrd_options .= ' AREA:' .$module. 'X#99999999' . $stacked['transparency'] . ':';
$rrd_options .= ' LINE1.25:' .$module. 'X#666666:';
$rrd_options .= ' AREA:' . $module . 'X#99999999' . $stacked['transparency'] . ':';
$rrd_options .= ' LINE1.25:' . $module . 'X#666666:';
$rrd_options .= " COMMENT:'\t'";
$rrd_options .= " GPRINT:{$module}X:MIN:%6.2lf";
$rrd_options .= " GPRINT:{$module}X:MAX:%6.2lf";

View File

@@ -54,7 +54,7 @@ foreach (Device::pluck('hostname') as $index => $hostname) {
}
$rrd_options .= " CDEF:poller=" . implode(',', $cdef);
$rrd_options .= " CDEF:avgpol=poller," . count($cdef) .",/";
$rrd_options .= " CDEF:avgpol=poller," . count($cdef) . ",/";
$rrd_options .= " 'COMMENT:Seconds Cur Min Max Avg Avg device\\n'";
$rrd_options .= ' LINE1.25:poller#36393D:Poller';
$rrd_options .= ' GPRINT:poller:LAST:%6.2lf GPRINT:poller:MIN:%6.2lf';
@@ -63,7 +63,7 @@ $rrd_options .= " 'GPRINT:avgpol:AVERAGE:%6.2lf\\n'";
if ($_GET['previous'] == 'yes') {
$rrd_options .= " COMMENT:' \\n'";
$rrd_options .= " CDEF:pollerX=" . implode(',', $cdefX);
$rrd_options .= " CDEF:avgpolX=pollerX," . count($cdefX) .",/";
$rrd_options .= " CDEF:avgpolX=pollerX," . count($cdefX) . ",/";
$rrd_options .= " LINE1.25:pollerX#CCCCCC:'Prev Poller'\t";
$rrd_options .= " GPRINT:pollerX:MIN:%6.2lf";
$rrd_options .= ' GPRINT:pollerX:MAX:%6.2lf GPRINT:pollerX:AVERAGE:%6.2lf';

View File

@@ -3,24 +3,24 @@
$i = 0;
foreach (dbFetchRows('SELECT * FROM `processors` AS P, devices AS D WHERE D.device_id = P.device_id') as $proc) {
$rrd_filename = rrd_name($proc['hostname'], array('processor', $proc['processor_type'], $proc['processor_index']));
$rrd_filename = rrd_name($proc['hostname'], ['processor', $proc['processor_type'], $proc['processor_index']]);
if (rrdtool_check_rrd_exists($rrd_filename)) {
$descr = short_hrDeviceDescr($proc['processor_descr']);
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $descr;
$rrd_list[$i]['ds'] = 'usage';
$rrd_list[$i]['area'] = 1;
$rrd_list[$i]['descr'] = $descr;
$rrd_list[$i]['ds'] = 'usage';
$rrd_list[$i]['area'] = 1;
$i++;
}
}
$unit_text = 'Load %';
$units = '%';
$units = '%';
$total_units = '%';
$colours = 'mixed';
$colours = 'mixed';
$scale_min = '0';
$scale_max = '100';

View File

@@ -3,29 +3,29 @@
$i = 0;
foreach (dbFetchRows('SELECT * FROM `processors` AS P, devices AS D WHERE D.device_id = P.device_id') as $proc) {
$rrd_filename = rrd_name($proc['hostname'], array('processor', $proc['processor_type'], $proc['processor_index']));
$rrd_filename = rrd_name($proc['hostname'], ['processor', $proc['processor_type'], $proc['processor_index']]);
if (rrdtool_check_rrd_exists($rrd_filename)) {
$descr = short_hrDeviceDescr($proc['processor_descr']);
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $descr;
$rrd_list[$i]['ds'] = 'usage';
$rrd_list[$i]['descr'] = $descr;
$rrd_list[$i]['ds'] = 'usage';
$i++;
}
}
$unit_text = 'Load %';
$units = '%';
$units = '%';
$total_units = '%';
$colours = 'oranges';
$colours = 'oranges';
$scale_min = '0';
$scale_max = '100';
$divider = $i;
$divider = $i;
$text_orig = 1;
$nototal = 1;
$nototal = 1;
require 'includes/html/graphs/generic_multi_simplex_seperated.inc.php';