update ports page and some other things

git-svn-id: http://www.observium.org/svn/observer/trunk@2506 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-19 11:15:01 +00:00
parent 627ed7af09
commit daa24154d4
7 changed files with 189 additions and 133 deletions
+3
View File
@@ -1256,3 +1256,6 @@ a.interface-upup:hover, a.interface-updown:hover, a.interface-admindown:hover {
} }
.auto-hint {
color:#AAAAAA;
}
+25 -31
View File
@@ -30,35 +30,33 @@ foreach (dbFetchRows("SELECT * FROM `devices`") as $device)
} }
?> ?>
<ul id="menium"> <ul id="menium">
<li><a href="overview/" class="drop"><img src="images/16/lightbulb.png" border="0" align="absmiddle" /> Overview</a><!-- Begin Home Item --> <li><a href="<?php echo(generate_url(array('page'=>'overview'))); ?>" class="drop"><img src="images/16/lightbulb.png" border="0" align="absmiddle" /> Overview</a>
<div class="dropdown_1column"> <div class="dropdown_1column">
<div class="col_1">
<div class="col_1">
<ul> <ul>
<?php if (isset($config['enable_map']) && $config['enable_map']) { <?php if (isset($config['enable_map']) && $config['enable_map']) {
echo('<li><a href="map/"><img src="images/16/map.png" border="0" align="absmiddle" /> Network Map</a></li>'); echo('<li><a href="'.generate_url(array('page'=>'overview')).'"><img src="images/16/map.png" border="0" align="absmiddle" /> Network Map</a></li>');
} ?> } ?>
<li><a href="eventlog/"><img src="images/16/report.png" border="0" align="absmiddle" /> Eventlog</a></li> <li><a href="<?php echo(generate_url(array('page'=>'eventlog'))); ?>"><img src="images/16/report.png" border="0" align="absmiddle" /> Eventlog</a></li>
<?php if (isset($config['enable_syslog']) && $config['enable_syslog']) { <?php if (isset($config['enable_syslog']) && $config['enable_syslog']) {
echo('<li><a href="syslog/"><img src="images/16/page.png" border="0" align="absmiddle" /> Syslog</a></li>'); echo('<li><a href="'.generate_url(array('page'=>'syslog')).'"><img src="images/16/page.png" border="0" align="absmiddle" /> Syslog</a></li>');
} ?> } ?>
<!-- <li><a href="alerts/"><img src="images/16/exclamation.png" border="0" align="absmiddle" /> Alerts</a></li> --> <!-- <li><a href="<?php echo(generate_url(array('page'=>'alerts'))); ?>"><img src="images/16/exclamation.png" border="0" align="absmiddle" /> Alerts</a></li> -->
<li><a href="inventory/"><img src="images/16/bricks.png" border="0" align="absmiddle" /> Inventory</a></li> <li><a href="<?php echo(generate_url(array('page'=>'inventory'))); ?>"><img src="images/16/bricks.png" border="0" align="absmiddle" /> Inventory</a></li>
</ul> </ul>
</div> </div>
<div class="col_1"> <div class="col_1">
<h3>Search</h3> <h3>Search</h3>
</div> </div>
<div class="col_1"> <div class="col_1">
<ul> <ul>
<li><a href="search/ipv4/"><img src="images/icons/ipv4.png" border="0" align="absmiddle" /> IPv4 Search</a></li> <li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv4'))); ?>"><img src="images/icons/ipv4.png" border="0" align="absmiddle" /> IPv4 Search</a></li>
<li><a href="search/ipv6/"><img src="images/icons/ipv6.png" border="0" align="absmiddle" /> IPv6 Search</a></li> <li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv6'))); ?>"><img src="images/icons/ipv6.png" border="0" align="absmiddle" /> IPv6 Search</a></li>
<li><a href="search/mac/"><img src="images/16/email_link.png" border="0" align="absmiddle" /> MAC Search</a></li> <li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'mac'))); ?>"><img src="images/16/email_link.png" border="0" align="absmiddle" /> MAC Search</a></li>
</ul> </ul>
</div> </div>
@@ -83,8 +81,6 @@ foreach ($config['device_types'] as $devtype)
} }
?> ?>
<li><hr width="140" /></li>
<li><a href="devices/alerted/"><img src="images/icons/alerts.png" border="0" align="absmiddle" /> Alerts (<?php echo($device_alerts) ?>)</a></li>
<?php <?php
if ($_SESSION['userlevel'] >= '10') { if ($_SESSION['userlevel'] >= '10') {
echo(' echo('
@@ -128,29 +124,27 @@ $(document).ready(function(){
); );
}); });
</script> </script>
</div> </div>
</li><!-- End 5 columns Item --> </li><!-- End 5 columns Item -->
<?php <?php
if ($config['show_services']) if ($config['show_services'])
{ {
?> ?>
<li><a href="services/" class="drop"><img src="images/16/cog.png" border="0" align="absmiddle" /> Services</a><!-- Begin 4 columns Item --> <li><a href="services/" class="drop"><img src="images/16/cog.png" border="0" align="absmiddle" /> Services</a><!-- Begin 4 columns Item -->
<div class="dropdown_4columns"><!-- Begin 4 columns container --> <div class="dropdown_4columns"><!-- Begin 4 columns container -->
<div class="col_1"> <div class="col_1">
<ul> <ul>
<li><a href="services/"><img src="images/16/cog.png" border="0" align="absmiddle" /> All Services </a></li> <li><a href="services/"><img src="images/16/cog.png" border="0" align="absmiddle" /> All Services </a></li>
<?php if ($service_alerts) { <?php if ($service_alerts) {
echo(' <li><hr width=140 /></li> echo(' <li><hr width=140 /></li>
<li><a href="services/?status=0"><img src="images/16/cog_error.png" border="0" align="absmiddle" /> Alerts ('.$service_alerts.')</a></li>'); <li><a href="services/status=0/"><img src="images/16/cog_error.png" border="0" align="absmiddle" /> Alerts ('.$service_alerts.')</a></li>');
} ?> } ?>
<?php <?php
@@ -161,8 +155,8 @@ if ($_SESSION['userlevel'] >= '10') {
<li><a href="delsrv/"><img src="images/16/cog_delete.png" border="0" align="absmiddle" /> Delete Service</a></li>'); <li><a href="delsrv/"><img src="images/16/cog_delete.png" border="0" align="absmiddle" /> Delete Service</a></li>');
} }
?> ?>
</ul> </ul>
</div> </div>
<div id="services_chart" class="col_3" style="height: 300px";> <div id="services_chart" class="col_3" style="height: 300px";>
</div> </div>
+8
View File
@@ -303,6 +303,14 @@ echo('</div>');
<script class="content_tooltips" type="text/javascript"> <script class="content_tooltips" type="text/javascript">
$(document).ready(function() { $('#content a[title]').qtip({ content: { text: false }, style: 'light' }); }); $(document).ready(function() { $('#content a[title]').qtip({ content: { text: false }, style: 'light' }); });
$('INPUT.auto-hint, TEXTAREA.auto-hint').focus(function(){
if($(this).val() == $(this).attr('title')){
$(this).val('');
$(this).removeClass('auto-hint');
}
});
</script> </script>
</body> </body>
+119 -69
View File
@@ -14,7 +14,7 @@ if($vars['searchbar'] != "hide")
<tr style='padding: 0px;'> <tr style='padding: 0px;'>
<form method='post' action=''> <form method='post' action=''>
<td width='200'> <td width='200'>
<select name='device_id' id='device_id'> <select name='device_id' id='device_id' style='width: 180px;'>
<option value=''>All Devices</option> <option value=''>All Devices</option>
<?php <?php
@@ -26,9 +26,11 @@ foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hos
} }
?> ?>
</select> </select>
<br />
<input type="hostname" name="hostname" id="hostname" title="Hostname" style='width: 180px;' <?php if(strlen($vars['hostname_text'])) {echo('value="'.$vars['hostname'].'"');} ?> />
</td> </td>
<td width='150'> <td width='120'>
<select name='state' id='state'> <select name='state' id='state' style='width: 100px;'>
<option value=''>All States</option> <option value=''>All States</option>
<option value='up' <?php if ($vars['state'] == "up") { echo("selected"); } ?>>Up</option> <option value='up' <?php if ($vars['state'] == "up") { echo("selected"); } ?>>Up</option>
<option value='down'<?php if ($vars['state'] == "down") { echo("selected"); } ?>>Down</option> <option value='down'<?php if ($vars['state'] == "down") { echo("selected"); } ?>>Down</option>
@@ -42,10 +44,9 @@ foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hos
<option value='ppp' <?php if ($vars['state'] == "ppp") { echo("selected"); } ?>>PPP</option> <option value='ppp' <?php if ($vars['state'] == "ppp") { echo("selected"); } ?>>PPP</option>
<option value='loopback' <?php if ($vars['state'] == "loopback") { echo("selected"); } ?>>Loopback</option> <option value='loopback' <?php if ($vars['state'] == "loopback") { echo("selected"); } ?>>Loopback</option>
</select> </select>
</td> <br />
<td width=110> <select name='ifSpeed' id='ifSpeed' style='width: 100px;'>
<select name='ifSpeed' id='ifSpeed'>
<option value=''>All Speeds</option> <option value=''>All Speeds</option>
<?php <?php
foreach (dbFetchRows("SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY `ifSpeed`") as $data) foreach (dbFetchRows("SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY `ifSpeed`") as $data)
@@ -60,8 +61,8 @@ foreach (dbFetchRows("SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY
?> ?>
</select> </select>
</td> </td>
<td width=200> <td width=170>
<select name='ifType' id='ifType'> <select name='ifType' id='ifType' style='width: 150px;'>
<option value=''>All Media</option> <option value=''>All Media</option>
<?php <?php
foreach (dbFetchRows("SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `ifType`") as $data) foreach (dbFetchRows("SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `ifType`") as $data)
@@ -76,7 +77,7 @@ foreach (dbFetchRows("SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `i
?> ?>
</select> </select>
<br /> <br />
<select name='port_descr_type' id='port_descr_type'> <select name='port_descr_type' id='port_descr_type' style='width: 150px;'>
<option value=''>All Port Types</option> <option value=''>All Port Types</option>
<?php <?php
foreach (dbFetchRows("SELECT `port_descr_type` FROM `ports` GROUP BY `port_descr_type` ORDER BY `port_descr_type`") as $data) foreach (dbFetchRows("SELECT `port_descr_type` FROM `ports` GROUP BY `port_descr_type` ORDER BY `port_descr_type`") as $data)
@@ -90,21 +91,49 @@ foreach (dbFetchRows("SELECT `port_descr_type` FROM `ports` GROUP BY `port_descr
} }
?> ?>
</select> </select>
</td>
<td>
</td>
<td width="220">
<input style="width: 200px;" title="Port Description" type="text" name="ifAlias" id="ifAlias" <?php if(strlen($vars['ifAlias'])) {echo('value="'.$vars['ifAlias'].'"');} ?> />
<select style="width: 200px;" name="location" id="location">
<option value="">All Locations</option>
<?php
### fix me function?
foreach (getlocations() as $location) ## FIXME function name sucks maybe get_locations ?
{
if ($location)
{
echo('<option value="'.$location.'"');
if ($location == $vars['location']) { echo(" selected"); }
echo(">".$location."</option>");
}
}
?>
</select>
</td>
<td>
<input type="text" name="ifAlias" id="ifAlias" size=40 value="<?php echo($vars['ifAlias']); ?>" />
Deleted <input type=checkbox id="deleted" name="deleted" value=1 <?php if ($vars['deleted']) { echo("checked"); } ?> ></input>
</td> </td>
<td style="text-align: right;">
<input style="align:right;" type=submit class=submit value=Search></div>
</td>
<td align=center>
<a href="<?php echo(generate_url($vars)); ?>" title="Update the browser URL to reflect the search criteria." >Update URL</a> <br />
<a href="<?php echo(generate_url(array('page' => 'monitor', 'section' => $vars['section'], 'bare' => $vars['bare']))); ?>" title="Reset critera to default." >Reset</a>
</td>
<td width=60>
<label for="ignore">
<input type=checkbox id="ignore" name="ignore" value=1 <?php if ($vars['ignore']) { echo("checked"); } ?> ></input> Ignored
</label>
<br />
<label for="disable">
<input type=checkbox id="disable" name="disable" value=1 <?php if ($vars['disable']) { echo("checked"); } ?> > Disabled</input>
</label>
<br />
<label for="deleted">
<input type=checkbox id="deleted" name="deleted" value=1 <?php if ($vars['deleted']) { echo("checked"); } ?> > Deleted</input>
</label>
</td>
<td style="text-align: center;" width=50>
<input style="align:right; padding: 10px;" type=submit class=submit value=Search></div>
<br />
<a href="<?php echo(generate_url(array('page' => 'ports', 'section' => $vars['section'], 'bare' => $vars['bare']))); ?>" title="Reset critera to default." >Reset</a>
</td>
</form> </form>
</tr> </tr>
</table> </table>
@@ -162,7 +191,11 @@ foreach ($menu_options as $option => $text)
} }
echo('<div style="float: right;">'); echo('<div style="float: right;">');
?>
<a href="<?php echo(generate_url($vars)); ?>" title="Update the browser URL to reflect the search criteria." >Update URL</a> |
<?php
if($vars['searchbar'] == "hide") if($vars['searchbar'] == "hide")
{ {
echo('<a href="'. generate_url($vars, array('searchbar' => '')).'">Search</a>'); echo('<a href="'. generate_url($vars, array('searchbar' => '')).'">Search</a>');
@@ -193,60 +226,75 @@ print_optionbar_end();
$param = array(); $param = array();
# FIXME block below is not totally used, at least the iftype stuff is bogus? # FIXME block below is not totally used, at least the iftype stuff is bogus?
if ($_GET['opta'] == "down" || $_GET['type'] == "down" || $vars['state'] == "down") #if ($vars['status'] == "down" || $_GET['type'] == "down" || $vars['state'] == "down")
{ #{
$where .= "AND I.ifAdminStatus = 'up' AND I.ifOperStatus = 'down' AND I.ignore = '0'"; # $where .= "AND I.ifAdminStatus = 'up' AND I.ifOperStatus = 'down' AND I.ignore = '0'";
} elseif ($_GET['optb'] == "admindown" || $_GET['type'] == "admindown" || $vars['state'] == "admindown") { #}
$where .= "AND I.ifAdminStatus = 'down'"; #if ($_GET['optb'] == "admindown" || $_GET['type'] == "admindown" || $vars['state'] == "admindown") {
} elseif ($_GET['optb'] == "errors" || $_GET['type'] == "errors" || $vars['state'] == "errors") { # $where .= "AND I.ifAdminStatus = 'down'";
$where .= "AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')"; #}
} elseif ($_GET['type'] == "up" || $vars['state'] == "up") { #if ($_GET['optb'] == "errors" || $_GET['type'] == "errors" || $vars['state'] == "errors") {
$where .= "AND I.ifOperStatus = 'up'"; # $where .= "AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')";
} elseif ($_GET['optb'] == "ignored" || $_GET['type'] == "ignored" || $vars['state'] == "ignored") { #}
$where .= "AND I.ignore = '1'"; #if ($vars['state'] == "up") {
} elseif ($_GET['type'] == "l2vlan" || $vars['state'] == "l2vlan") { # $where .= "AND I.ifOperStatus = 'up'";
$where .= " AND I.ifType = 'l2vlan'"; #}
} elseif ($_GET['type'] == "ethernet" || $vars['state'] == "ethernet") {
$where .= " AND I.ifType = 'ethernetCsmacd'";
} elseif ($_GET['type'] == "loopback" || $vars['state'] == "loopback") {
$where .= " AND I.ifType = 'softwareLoopback'";
} elseif ($_GET['type'] == "sonet" || $vars['state'] == "sonet") {
$where .= " AND I.ifType = 'sonet'";
} elseif ($vars['state'] == "propvirtual") {
$where .= " AND I.ifType = 'propVirtual'";
} elseif ($vars['state'] == "ppp") {
$where .= " AND I.ifType = 'ppp'";
}
if(!isset($vars['ignore'])) { $vars['ignore'] = "0"; }
if(!isset($vars['disabled'])) { $vars['disabled'] = "0"; }
if(!isset($vars['deleted'])) { $vars['deleted'] = "0"; }
if (is_numeric($vars['device_id'])) foreach($vars as $var => $value)
{
$where .= " AND I.device_id = ?";
$param[] = $vars['device_id'];
}
if ($vars['ifType'])
{ {
$where .= " AND I.ifType = ?"; if($value != "")
$param[] = $vars['ifType']; {
switch ($var)
{
case 'hostname':
case 'location':
$where .= " AND D.$var LIKE ?";
$param[] = "%".$value."%";
case 'device_id':
case 'deleted':
case 'ignore':
case 'disable':
case 'ifSpeed':
if (is_numeric($value))
{
$where .= " AND I.$var = ?";
$param[] = $value;
}
break;
case 'ifType':
$where .= " AND I.$var = ?";
$param[] = $value;
break;
case 'ifAlias':
case 'port_descr_type':
$where .= " AND I.$var LIKE ?";
$param[] = "%".$value."%";
break;
case 'state':
if ($value == "down")
{
$where .= "AND I.ifAdminStatus = ? AND I.ifOperStatus = ?";
$param[] = "up";
$param[] = "down";
} elseif($value == "up") {
$where .= "AND I.ifAdminStatus = ? AND I.ifOperStatus = ?";
$param[] = "up";
$param[] = "up";
} elseif($value == "admindown") {
$where .= "AND I.ifAdminStatus = ?";
$param[] = "down";
}
break;
}
}
} }
if ($vars['port_descr_type'])
{
$where .= " AND I.port_descr_type = ?";
$param[] = $vars['port_descr_type'];
}
if (is_numeric($vars['ifSpeed']))
{
$where .= " AND I.ifSpeed = ?";
$param[] = $vars['ifSpeed'];
}
if ($vars['ifAlias']) {
$where .= " AND I.ifAlias LIKE ?";
$param[] = "%".$vars['ifAlias']."%";
}
if ($vars['deleted'] || $_GET['type'] == "deleted") { $where .= " AND I.deleted = '1'"; }
$query = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id ".$where." ORDER BY D.hostname, I.ifIndex"; $query = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id ".$where." ORDER BY D.hostname, I.ifIndex";
@@ -254,6 +302,8 @@ $row = 1;
list($format, $subformat) = explode("_", $vars['format']); list($format, $subformat) = explode("_", $vars['format']);
$ports = dbFetchRows($query, $param);
if(file_exists('pages/ports/'.$format.'.inc.php')) if(file_exists('pages/ports/'.$format.'.inc.php'))
{ {
include('pages/ports/'.$format.'.inc.php'); include('pages/ports/'.$format.'.inc.php');
+13 -13
View File
@@ -1,32 +1,32 @@
<? <?
foreach (dbFetchRows($query, $param) as $interface) foreach ($ports as $port)
{ {
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$speed = humanspeed($interface['ifSpeed']); $speed = humanspeed($port['ifSpeed']);
$type = humanmedia($interface['ifType']); $type = humanmedia($port['ifType']);
$interface['in_rate'] = formatRates($interface['ifInOctets_rate'] * 8); $port['in_rate'] = formatRates($port['ifInOctets_rate'] * 8);
$interface['out_rate'] = formatRates($interface['ifOutOctets_rate'] * 8); $port['out_rate'] = formatRates($port['ifOutOctets_rate'] * 8);
if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) if ($port['in_errors'] > 0 || $port['out_errors'] > 0)
{ {
$error_img = generate_port_link($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors); $error_img = generate_port_link($port,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; } } else { $error_img = ""; }
if (port_permitted($interface['interface_id'], $interface['device_id'])) if (port_permitted($port['interface_id'], $port['device_id']))
{ {
$interface = ifLabel($interface, $device); $port = ifLabel($port, $device);
$graph_type = "port_" . $subformat; $graph_type = "port_" . $subformat;
echo("<div style='display: block; padding: 1px; margin: 2px; min-width: 393px; max-width:393px; min-height:180px; max-height:180px; text-align: center; float: left; background-color: #f5f5f5;'> echo("<div style='display: block; padding: 1px; margin: 2px; min-width: 393px; max-width:393px; min-height:180px; max-height:180px; text-align: center; float: left; background-color: #f5f5f5;'>
<a href='device/".$interface['device_id']."/port/".$interface['interface_id']."/' onmouseover=\"return overlib('\ <a href='device/".$port['device_id']."/port/".$port['interface_id']."/' onmouseover=\"return overlib('\
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$interface['ifDescr']."</div>\ <div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$port['ifDescr']."</div>\
<img src=\'graph.php?type=$graph_type&amp;id=".$interface['interface_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=450&amp;height=150&amp;title=yes\'>\ <img src=\'graph.php?type=$graph_type&amp;id=".$port['interface_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=450&amp;height=150&amp;title=yes\'>\
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
"<img src='graph.php?type=$graph_type&amp;id=".$interface['interface_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=315&amp;height=110&amp;legend=no&amp;title=yes'> "<img src='graph.php?type=$graph_type&amp;id=".$port['interface_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=315&amp;height=110&amp;legend=no&amp;title=yes'>
</a> </a>
</div>"); </div>");
} }
+14 -14
View File
@@ -7,35 +7,35 @@ echo("<tr class=tablehead><td></td><th>Device</a></th><th>Interface</th><th>Spee
$row = 1; $row = 1;
foreach (dbFetchRows($query, $param) as $interface) foreach ($ports as $port)
{ {
if (port_permitted($interface['interface_id'], $interface['device_id'])) if (port_permitted($port['interface_id'], $port['device_id']))
{ {
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$speed = humanspeed($interface['ifSpeed']); $speed = humanspeed($port['ifSpeed']);
$type = humanmedia($interface['ifType']); $type = humanmedia($port['ifType']);
if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) if ($port['in_errors'] > 0 || $port['out_errors'] > 0)
{ {
$error_img = generate_port_link($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors); $error_img = generate_port_link($port,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; } } else { $error_img = ""; }
$interface['in_rate'] = formatRates($interface['ifInOctets_rate'] * 8); $port['in_rate'] = formatRates($port['ifInOctets_rate'] * 8);
$interface['out_rate'] = formatRates($interface['ifOutOctets_rate'] * 8); $port['out_rate'] = formatRates($port['ifOutOctets_rate'] * 8);
$interface = ifLabel($interface, $device); $port = ifLabel($port, $device);
echo("<tr bgcolor=$row_colour> echo("<tr bgcolor=$row_colour>
<td width=5></td> <td width=5></td>
<td width=200 class=list-bold><a href='" . generate_device_url($interface) . "'>".$interface['hostname']."</a></td> <td width=200 class=list-bold><a href='" . generate_device_url($port) . "'>".$port['hostname']."</a></td>
<td width=150 class=list-bold><a href='" . generate_port_url($interface) . "'>".fixIfName($interface['label'])." $error_img</td> <td width=150 class=list-bold><a href='" . generate_port_url($port) . "'>".fixIfName($port['label'])." $error_img</td>
<td width=110 >$speed</td> <td width=110 >$speed</td>
<td width=110 class=green>".$interface['in_rate']."</td> <td width=110 class=green>".$port['in_rate']."</td>
<td width=110 class=blue>".$interface['out_rate']."</td> <td width=110 class=blue>".$port['out_rate']."</td>
<td width=200>$type</td> <td width=200>$type</td>
<td>" . $interface['ifAlias'] . "</td> <td>" . $port['ifAlias'] . "</td>
</tr>\n"); </tr>\n");
$row++; $row++;
+7 -6
View File
@@ -2,7 +2,7 @@
$sections = array('ipv4' => 'IPv4 Address', 'ipv6' => 'IPv6 Address', 'mac' => 'MAC Address'); $sections = array('ipv4' => 'IPv4 Address', 'ipv6' => 'IPv6 Address', 'mac' => 'MAC Address');
if (!$_GET['opta']) { $_GET['opta'] = "ipv4"; } if (!isset($vars['search'])) { $vars['search'] = "ipv4"; }
print_optionbar_start('', ''); print_optionbar_start('', '');
@@ -12,14 +12,15 @@ unset($sep);
foreach ($sections as $type => $texttype) foreach ($sections as $type => $texttype)
{ {
echo($sep); echo($sep);
if ($_GET['opta'] == $type) if ($vars['search'] == $type)
{ {
echo("<span class='pagemenu-selected'>"); echo("<span class='pagemenu-selected'>");
} }
echo('<a href="search/' . $type . ($_GET['optb'] ? '/' . $_GET['optb'] : ''). '/">' . $texttype .'</a>'); # echo('<a href="search/' . $type . ($_GET['optb'] ? '/' . $_GET['optb'] : ''). '/">' . $texttype .'</a>');
echo(generate_link($texttype, array('page'=>'search','search'=>$type)));
if ($_GET['opta'] == $type) { echo("</span>"); } if ($vars['search'] == $type) { echo("</span>"); }
$sep = ' | '; $sep = ' | ';
} }
@@ -27,12 +28,12 @@ unset ($sep);
print_optionbar_end('', ''); print_optionbar_end('', '');
switch ($_GET['opta']) switch ($vars['search'])
{ {
case 'ipv4': case 'ipv4':
case 'ipv6': case 'ipv6':
case 'mac': case 'mac':
include('pages/search/'.$_GET['opta'].'.inc.php'); include('pages/search/'.$vars['search'].'.inc.php');
break; break;
default: default:
echo("<h2>Error. Please report this to observium developers.</h2>"); echo("<h2>Error. Please report this to observium developers.</h2>");