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-09-15 16:52:28 +00:00
|
|
|
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($id)) as $port)
|
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)
|
|
|
|
{
|
2011-09-15 16:52:28 +00:00
|
|
|
if (preg_match($iftype ."i", $port['ifType']))
|
2011-03-12 08:50:47 +00:00
|
|
|
{
|
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)
|
|
|
|
{
|
2011-09-15 16:52:28 +00:00
|
|
|
if (preg_match($ifdescr."i", $port['ifDescr']) || preg_match($ifdescr."i", $port['ifName']) || preg_match($ifdescr."i", $port['portName']))
|
2011-03-12 08:50:47 +00:00
|
|
|
{
|
2010-04-20 15:46:17 +00:00
|
|
|
$ignore = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-15 16:52:28 +00:00
|
|
|
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd");
|
2011-09-18 15:38:05 +00:00
|
|
|
if ($ignore != 1 && is_file($rrd_filename))
|
2011-03-12 08:50:47 +00:00
|
|
|
{
|
2011-09-23 14:57:19 +00:00
|
|
|
$port = ifLabel($port); ## Fix Labels! ARGH. This needs to be in the bloody database!
|
|
|
|
|
2011-09-14 13:44:19 +00:00
|
|
|
$rrd_filenames[] = $rrd_filename;
|
|
|
|
$rrd_list[$i]['filename'] = $rrd_filename;
|
2011-09-23 14:57:19 +00:00
|
|
|
$rrd_list[$i]['descr'] = $port['label'];
|
2011-09-21 11:59:59 +00:00
|
|
|
$rrd_list[$i]['ds_in'] = $ds_in;
|
|
|
|
$rrd_list[$i]['ds_out'] = $ds_out;
|
2011-09-14 13:44:19 +00:00
|
|
|
$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-21 11:59:59 +00:00
|
|
|
$units ='b';
|
2011-09-14 13:44:19 +00:00
|
|
|
$total_units ='B';
|
|
|
|
$colours_in ='greens';
|
|
|
|
$multiplier = "8";
|
|
|
|
$colours_out = 'blues';
|
|
|
|
|
|
|
|
$nototal = 1;
|
|
|
|
|
2011-09-21 11:59:59 +00:00
|
|
|
$ds_in = "INOCTETS";
|
|
|
|
$ds_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
|
|
|
?>
|