allow customisable filtering of interfaces from device_bits graph (also usable on theoretical device_pkts and device_errors)

git-svn-id: http://www.observium.org/svn/observer/trunk@1068 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-04-20 15:46:17 +00:00
parent caa5d5e4a0
commit 38a33e5661
8 changed files with 188 additions and 81 deletions

View File

@@ -2,14 +2,34 @@
## Generate a list of ports and then call the multi_bits grapher to generate from the list
$device = mres($_GET['device']);
$hostname = gethostbyid($device);
if($_GET['device']) {
$device = device_by_id_cache(mres($_GET['device']));
} elseif($_GET['id']) {
$device = device_by_id_cache(mres($_GET['id']));
}
$query = mysql_query("SELECT `ifIndex`,`interface_id` FROM `ports` WHERE `device_id` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%' AND `ifType` != 'l2vlan'");
while($int = mysql_fetch_row($query)) {
if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . safename($int[0] . ".rrd"))) {
$rrd_filenames[] = $config['rrd_dir'] . "/" . $hostname . "/" . safename($int[0] . ".rrd");
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."'");
while($int = mysql_fetch_assoc($query)) {
$ignore = 0;
if(is_array($config['device_traffic_iftype'])) {
foreach($config['device_traffic_iftype'] as $iftype) {
if (preg_match($iftype ."i", $int['ifType'])) {
$ignore = 1;
}
}
}
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'])) {
$ignore = 1;
}
}
}
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($int['ifIndex'] . ".rrd")) && $ignore != 1) {
$rrd_filenames[] = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($int['ifIndex'] . ".rrd");
}
unset($ignore);
}
$rra_in = "INOCTETS";

View File

@@ -162,8 +162,8 @@ echo('<li><a href="ports/?status=0"><img src="images/16/link_error.png" border="
<!--[if IE 7]><!--></a><!--<![endif]-->
<table><tr><td>
<ul>
<li><a href="health/processors/"><img src="images/icons/cpuload.png" border="0" align="absmiddle" /> Processorss</a></li>
<li><a href="health/memory/"><img src="images/icons/mempool.png" border="0" align="absmiddle" /> Memory</a></li>
<li><a href="health/processors/"><img src="images/icons/overview/processors.png" border="0" align="absmiddle" /> Processorss</a></li>
<li><a href="health/memory/"><img src="images/icons/overview/mempools.png" border="0" align="absmiddle" /> Memory</a></li>
<li><a href="health/storage/"><img src="images/icons/storage.png" border="0" align="absmiddle" /> Storage</a></li>
<li><hr width=140 /></li>
<li><a href="health/temperatures/"><img src="images/icons/temperature.png" border="0" align="absmiddle" /> Temperatures</a></li>

View File

@@ -13,7 +13,7 @@ if(!is_integer($syslog_iter/2)) { $bg_colour = $list_colour_a; } else { $bg_colo
echo("<td class=syslog width=125>" . $entry['date'] . "</td>");
# $entry['hostname'] = shorthost(gethostbyid($entry['host']), 20);
$entry['hostname'] = shorthost($entry['hostname'], 20);
if($_GET['page'] != "device") {
echo("<td width=160><strong>".generatedevicelink($entry)."</strong></td>");