2009-09-25 12:18:25 +00:00
|
|
|
<?php
|
|
|
|
|
2010-02-20 17:22:22 +00:00
|
|
|
## Generate a list of ports and then call the multi_bits grapher to generate from the list
|
2009-09-25 12:18:25 +00:00
|
|
|
|
2010-05-02 19:47:09 +00:00
|
|
|
$device = device_by_id_cache($id);
|
2010-04-20 15:46:17 +00:00
|
|
|
|
2011-05-13 12:57:11 +00:00
|
|
|
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($id)) as $int)
|
2011-03-12 08:50:47 +00:00
|
|
|
{
|
2010-04-20 15:46:17 +00:00
|
|
|
$ignore = 0;
|
2011-03-12 08:50:47 +00:00
|
|
|
if (is_array($config['device_traffic_iftype']))
|
|
|
|
{
|
|
|
|
foreach ($config['device_traffic_iftype'] as $iftype)
|
|
|
|
{
|
|
|
|
if (preg_match($iftype ."i", $int['ifType']))
|
|
|
|
{
|
2010-04-20 15:46:17 +00:00
|
|
|
$ignore = 1;
|
2011-03-12 08:50:47 +00:00
|
|
|
}
|
2010-04-20 15:46:17 +00:00
|
|
|
}
|
|
|
|
}
|
2011-03-12 08:50:47 +00:00
|
|
|
if (is_array($config['device_traffic_descr']))
|
|
|
|
{
|
|
|
|
foreach ($config['device_traffic_descr'] as $ifdescr)
|
|
|
|
{
|
|
|
|
if (preg_match($ifdescr."i", $int['ifDescr']) || preg_match($ifdescr."i", $int['ifName']) || preg_match($ifdescr."i", $int['portName']))
|
|
|
|
{
|
2010-04-20 15:46:17 +00:00
|
|
|
$ignore = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-14 13:44:19 +00:00
|
|
|
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd");
|
|
|
|
if (is_file($rrd_filename) && $ignore != 1)
|
2011-03-12 08:50:47 +00:00
|
|
|
{
|
2011-09-14 13:44:19 +00:00
|
|
|
$rrd_filenames[] = $rrd_filename;
|
|
|
|
$rrd_list[$i]['filename'] = $rrd_filename;
|
|
|
|
$rrd_list[$i]['descr'] = $port['ifDescr'];
|
|
|
|
$rrd_list[$i]['rra_in'] = $rra_in;
|
|
|
|
$rrd_list[$i]['rra_out'] = $rra_out;
|
|
|
|
$i++;
|
2009-09-25 12:18:25 +00:00
|
|
|
}
|
2011-03-12 08:50:47 +00:00
|
|
|
|
2010-04-20 15:46:17 +00:00
|
|
|
unset($ignore);
|
2009-09-25 12:18:25 +00:00
|
|
|
}
|
|
|
|
|
2011-09-14 13:44:19 +00:00
|
|
|
$units ='bps';
|
|
|
|
$total_units ='B';
|
|
|
|
$colours_in ='greens';
|
|
|
|
$multiplier = "8";
|
|
|
|
$colours_out = 'blues';
|
|
|
|
|
|
|
|
$nototal = 1;
|
|
|
|
|
|
|
|
|
2009-10-27 13:04:16 +00:00
|
|
|
$rra_in = "INOCTETS";
|
2011-03-12 08:50:47 +00:00
|
|
|
$rra_out = "OUTOCTETS";
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-14 13:38:01 +00:00
|
|
|
$graph_title .= "::bits";
|
|
|
|
|
2009-10-27 13:04:16 +00:00
|
|
|
$colour_line_in = "006600";
|
|
|
|
$colour_line_out = "000099";
|
|
|
|
$colour_area_in = "CDEB8B";
|
|
|
|
$colour_area_out = "C3D9FF";
|
|
|
|
|
2011-09-14 13:44:19 +00:00
|
|
|
include("includes/graphs/generic_multi_bits_separated.inc.php");
|
2009-09-25 12:18:25 +00:00
|
|
|
|
2011-05-13 12:57:11 +00:00
|
|
|
?>
|