2011-11-29 10:34:18 +00:00
|
|
|
<?php
|
|
|
|
|
2012-05-25 12:24:34 +00:00
|
|
|
// Generate a list of ports and then call the multi_bits grapher to generate from the list
|
2020-09-21 15:40:17 +02:00
|
|
|
$ds_in = 'INOCTETS';
|
2015-07-10 13:36:21 +02:00
|
|
|
$ds_out = 'OUTOCTETS';
|
2011-11-29 10:34:18 +00:00
|
|
|
|
2015-07-10 13:36:21 +02:00
|
|
|
$i = 1;
|
|
|
|
foreach ($devices as $device) {
|
2020-09-21 15:40:17 +02:00
|
|
|
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ? AND `disabled` = 0', [$device['device_id']]) as $int) {
|
2015-07-10 13:36:21 +02:00
|
|
|
$ignore = 0;
|
2019-06-23 00:29:12 -05:00
|
|
|
if (is_array(\LibreNMS\Config::get('device_traffic_iftype'))) {
|
|
|
|
foreach (\LibreNMS\Config::get('device_traffic_iftype') as $iftype) {
|
2020-09-21 15:40:17 +02:00
|
|
|
if (preg_match($iftype . 'i', $int['ifType'])) {
|
2015-07-10 13:36:21 +02:00
|
|
|
$ignore = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-23 00:29:12 -05:00
|
|
|
if (is_array(\LibreNMS\Config::get('device_traffic_descr'))) {
|
|
|
|
foreach (\LibreNMS\Config::get('device_traffic_descr') as $ifdescr) {
|
2020-09-21 15:40:17 +02:00
|
|
|
if (preg_match($ifdescr . 'i', $int['ifDescr']) || preg_match($ifdescr . 'i', $int['ifName'])) {
|
2015-07-10 13:36:21 +02:00
|
|
|
$ignore = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-18 20:28:22 -05:00
|
|
|
$rrd_file = get_port_rrdfile_path($device['hostname'], $int['port_id']);
|
2021-03-28 17:25:30 -05:00
|
|
|
if (Rrd::checkRrdExists($rrd_file) && $ignore != 1) {
|
2020-09-21 15:40:17 +02:00
|
|
|
$rrd_filename = $rrd_file; // FIXME: Can this be unified without side-effects?
|
|
|
|
$rrd_list[$i]['filename'] = $rrd_filename;
|
|
|
|
$rrd_list[$i]['descr'] = $port['label'];
|
|
|
|
$rrd_list[$i]['descr_in'] = $device['hostname'];
|
2021-03-28 17:25:30 -05:00
|
|
|
$rrd_list[$i]['descr_out'] = \LibreNMS\Util\Clean::html($port['ifAlias'], []);
|
2020-09-21 15:40:17 +02:00
|
|
|
$rrd_list[$i]['ds_in'] = $ds_in;
|
|
|
|
$rrd_list[$i]['ds_out'] = $ds_out;
|
2015-07-10 13:36:21 +02:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($ignore);
|
|
|
|
}//end foreach
|
|
|
|
}//end foreach
|
|
|
|
|
2020-09-21 15:40:17 +02:00
|
|
|
$units = 'b';
|
2015-07-10 13:36:21 +02:00
|
|
|
$total_units = 'B';
|
2020-09-21 15:40:17 +02:00
|
|
|
$colours_in = 'greens';
|
|
|
|
$multiplier = '8';
|
2011-11-29 10:46:02 +00:00
|
|
|
$colours_out = 'blues';
|
|
|
|
|
|
|
|
$nototal = 1;
|
|
|
|
|
2015-07-10 13:36:21 +02:00
|
|
|
$graph_title .= '::bits';
|
2011-11-29 10:34:18 +00:00
|
|
|
|
2020-09-21 15:40:17 +02:00
|
|
|
$colour_line_in = '006600';
|
2015-07-10 13:36:21 +02:00
|
|
|
$colour_line_out = '000099';
|
2020-09-21 15:40:17 +02:00
|
|
|
$colour_area_in = 'CDEB8B';
|
2015-07-10 13:36:21 +02:00
|
|
|
$colour_area_out = 'C3D9FF';
|
2011-11-29 10:34:18 +00:00
|
|
|
|
2019-04-11 23:26:42 -05:00
|
|
|
require 'includes/html/graphs/generic_multi_bits_separated.inc.php';
|