git-svn-id: http://www.observium.org/svn/observer/trunk@442 61d68cd4-352d-0410-923a-c4978735b2b8

This commit is contained in:
Adam Amstrong
2009-08-05 16:05:14 +00:00
parent 234d7e7a09
commit 1ea54588eb
7 changed files with 244 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
<?php // vim:fenc=utf-8:filetype=php:ts=4
echo("<div style='width: auto; text-align: right; padding: 10px; display:block; background-color: #eeeeee;'>");
echo("<div style='background-color: ".$list_colour_b."; margin: auto; margin-bottom: 5px; text-align: left; padding: 7px; padding-left: 11px; clear: both; display:block; height:20px;'>");
unset ($sep);
$query = mysql_query("SELECT `entSensorType` FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entSensorType != '' AND entSensorType NOT LIKE 'No%' GROUP BY `entSensorType` ORDER BY `entSensorType`");
while($data = mysql_fetch_array($query)) {

View File

@@ -1,44 +1,18 @@
<?php
echo("
<div style='background-color: ".$list_colour_b."; margin: auto; text-align: left; padding: 7px; clear: both; display:block; height:20px;'>
<div style='background-color: ".$list_colour_b."; margin: auto; margin-bottom: 5px; text-align: left; padding: 7px; padding-left: 11px; clear: both; display:block; height:20px;'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/'>Basic</a> |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/details/'>Details</a> | Graphs:
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/'>Bits</a>
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/thumbs/'>Compact</a>) |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/pkts/'>Packets</a> |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/nupkts/'>NU Packets</a> |
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/thumbs/'>Mini</a>) |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/pkts/'>Packets</a>
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/pkts/thumbs/'>Mini</a>) |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/nupkts/'>NU Packets</a>
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/nupkts/thumbs/'>Mini</a>) |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/errors/'>Errors</a>
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/errors/thumbs/'>Mini</a>)</a>
</div> ");
if($_GET['optc'] == thumbs) {
$timeperiods = array('-1day','-1week','-1month','-1year');
$from = '-1day';
echo("<div style='display: block; clear: both; margin: auto; background-color: black;'>");
$sql = "select * from interfaces WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
$query = mysql_query($sql);
unset ($seperator);
while($interface = mysql_fetch_array($query)) {
echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>
<div style='font-weight: bold;'>".makeshortif($interface['ifDescr'])."</div>
<a href='device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('\
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$interface['ifDescr']."</div>\
".$interface['ifAlias']." \
<img src=\'graph.php?type=bits&if=".$interface['interface_id']."&from=".$from."&to=".$now."&width=450&height=150\'>\
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
"<img src='graph.php?type=bits&if=".$interface['interface_id']."&from=".$from."&to=".$now."&width=180&height=45&legend=no'>
</a>
<div style='font-size: 9px;'>".truncate(short_port_descr($interface['ifAlias']), 32, '')."</div>
</div>");
}
echo("</div>");
} else {
if($_GET['opta'] == graphs ) {
if($_GET['optb']) {
$graph_type = $_GET['optb'];
@@ -48,6 +22,33 @@ if($_GET['opta'] == graphs ) {
$dographs = 1;
}
if($_GET['optc'] == thumbs) {
$timeperiods = array('-1day','-1week','-1month','-1year');
$from = '-1day';
echo("<div style='display: block; clear: both; margin: auto;'>");
$sql = "select * from interfaces WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
$query = mysql_query($sql);
unset ($seperator);
while($interface = mysql_fetch_array($query)) {
echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>
<div style='font-weight: bold;'>".makeshortif($interface['ifDescr'])."</div>
<a href='device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('\
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$interface['ifDescr']."</div>\
".$interface['ifAlias']." \
<img src=\'graph.php?type=$graph_type&if=".$interface['interface_id']."&from=".$from."&to=".$now."&width=450&height=150\'>\
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
"<img src='graph.php?type=$graph_type&if=".$interface['interface_id']."&from=".$from."&to=".$now."&width=180&height=45&legend=no'>
</a>
<div style='font-size: 9px;'>".truncate(short_port_descr($interface['ifAlias']), 32, '')."</div>
</div>");
}
echo("</div>");
} else {
if($_GET['opta'] == "details" ) {
$port_details = 1;
}

View File

@@ -1,5 +1,14 @@
<?php
echo("
<div style='background-color: ".$list_colour_b."; margin: auto; margin-bottom: 5px; text-align: left; padding: 7px; padding-left: 11px; clear: both; display:block; height:20px;'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vlans/'>Basic</a> | Graphs :
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vlans/bits/'>Bits</a> |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vlans/pkts/'>Packets</a> |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vlans/nupkts/'>NU Packets</a> |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vlans/errors/'>Errors</a>
</div> ");
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "1";
$vlan_query = mysql_query("select * from vlans WHERE device_id = '".$_GET['id']."' ORDER BY 'vlan_vlan'");

View File

@@ -1,5 +1,15 @@
<?php
echo("
<div style='background-color: ".$list_colour_b."; margin: auto; margin-bottom: 5px; text-align: left; padding: 7px; padding-left: 11px; clear: both; display:block; height:20px;'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vrfs/'>Basic</a> | Graphs :
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vrfs/bits/'>Bits</a> |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vrfs/pkts/'>Packets</a> |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vrfs/nupkts/'>NU Packets</a> |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vrfs/errors/'>Errors</a>
</div> ");
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "1";
$vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$_GET['id']."' ORDER BY 'vrf_name'");

92
html/pages/ipv4.php Normal file
View File

@@ -0,0 +1,92 @@
<table cellpadding=2 cellspacing=0 class=devicetable width=100%>
<tr bgcolor='#eeeeee' style='padding: 3px;'>
<form method='post' action=''>
<td width='200' style="padding: 10px;">
<select name='device_id' id='device_id'>
<option value=''>All Devices</option>
<?php
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['device_id']."'");
if($data['device_id'] == $_POST['device_id']) { echo("selected"); }
echo(">".$data['hostname']."</option>");
}
?>
</select>
</td>
<td width='200' style="padding: 10px;">
<select name='interface' id='interface'>
<option value=''>All Interfaces</option>
<option value='Loopback%' <?php if($_POST['interface'] == "Loopback%"){ echo("selected");} ?> >Loopbacks</option>
<option value='Vlan%' <?php if($_POST['interface'] == "Vlan%"){ echo("selected");} ?> >VLANs</option>
</select>
</td>
<td>
</td>
<td width=400>
<input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" />
<input style="align:right;" type=submit value=Search></div>
</td>
</form>
</tr>
</table>
<?php
echo("<table width=100%>");
if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; }
$sql = "SELECT * FROM `ipv4_addresses` AS A, `interfaces` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id $where ORDER BY A.ipv4_address";
$query = mysql_query($sql);
echo("<tr class=tablehead><th>Device</a></th><th>Interface</th><th>Address</th><th>Subnet</th><th>Description</th></tr>");
$row = 1;
while($interface = mysql_fetch_array($query)) {
if($_POST['address']) {
list($addy, $mask) = explode("/", $_POST['address']);
if(!$mask) { $mask = "/32"; }
if (!match_network($addy . "/" . $mask, $interface['ipv4_address'] )) { $ignore = 1; }
}
if(!$ignore) {
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$speed = humanspeed($interface['ifSpeed']);
$type = humanmedia($interface['ifType']);
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; }
if( interfacepermitted($interface['interface_id']) )
{
echo("<tr bgcolor=$row_colour>
<td class=list-bold>" . generatedevicelink($interface) . "</td>
<td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img</td>
<td>" . $interface['ipv4_address'] . "</td>
<td>" . $interface['ipv4_network'] . "</td>
<td>" . $interface['ifAlias'] . "</td>
</tr>\n");
$row++;
}
}
unset($ignore);
}
echo("</table>");
?>

92
html/pages/ipv6.php Normal file
View File

@@ -0,0 +1,92 @@
<table cellpadding=2 cellspacing=0 class=devicetable width=100%>
<tr bgcolor='#eeeeee' style='padding: 3px;'>
<form method='post' action=''>
<td width='200' style="padding: 10px;">
<select name='device_id' id='device_id'>
<option value=''>All Devices</option>
<?php
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['device_id']."'");
if($data['device_id'] == $_POST['device_id']) { echo("selected"); }
echo(">".$data['hostname']."</option>");
}
?>
</select>
</td>
<td width='200' style="padding: 10px;">
<select name='interface' id='interface'>
<option value=''>All Interfaces</option>
<option value='Loopback%' <?php if($_POST['interface'] == "Loopback%"){ echo("selected");} ?> >Loopbacks</option>
<option value='Vlan%' <?php if($_POST['interface'] == "Vlan%"){ echo("selected");} ?> >VLANs</option>
</select>
</td>
<td>
</td>
<td width=400>
<input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" />
<input style="align:right;" type=submit value=Search></div>
</td>
</form>
</tr>
</table>
<?php
echo("<table width=100%>");
if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; }
$sql = "SELECT * FROM `ipv6_addresses` AS A, `interfaces` AS I, `devices` AS D, `ipv6_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv6_network_id = A.ipv6_network_id $where ORDER BY A.ipv6_address";
$query = mysql_query($sql);
echo("<tr class=tablehead><th>Device</a></th><th>Interface</th><th>Address</th><th>Subnet</th><th>Description</th></tr>");
$row = 1;
while($interface = mysql_fetch_array($query)) {
if($_POST['address']) {
list($addy, $mask) = explode("/", $_POST['address']);
if(!$mask) { $mask = "128"; }
if(!Net_IPv6::isInNetmask ( $interface['ipv6_address'], $addy, $mask )) { $ignore = 1; } else { $ignore = 0;}
}
if(!$ignore) {
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$speed = humanspeed($interface['ifSpeed']);
$type = humanmedia($interface['ifType']);
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; }
if( interfacepermitted($interface['interface_id']) )
{
echo("<tr bgcolor=$row_colour>
<td class=list-bold>" . generatedevicelink($interface) . "</td>
<td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img</td>
<td>" . Net_IPv6::compress($interface['ipv6_address']) . "</td>
<td>" . $interface['ipv6_network'] . "</td>
<td>" . $interface['ifAlias'] . "</td>
</tr>\n");
$row++;
}
}
unset($ignore);
}
echo("</table>");
?>

View File

@@ -1,5 +1,15 @@
<?php
echo("
<div style='background-color: ".$list_colour_b."; margin: auto; margin-bottom: 5px; text-align: left; padding: 7px; padding-left: 11px; clear: both; display:block; height:20px;'>
<a href='".$config['base_url']. "/vrfs/'>Basic</a> | Graphs :
<a href='".$config['base_url']. "/vrfs/bits/'>Bits</a> |
<a href='".$config['base_url']. "/vrfs/pkts/'>Packets</a> |
<a href='".$config['base_url']. "/vrfs/nupkts/'>NU Packets</a> |
<a href='".$config['base_url']. "/vrfs/errors/'>Errors</a>
</div> ");
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "1";
$vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`");
@@ -29,10 +39,18 @@
echo("</td><td>");
$interfaces = mysql_query("SELECT * FROM `interfaces` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'");
unset($seperator);
while($interface = mysql_fetch_array($interfaces)) {
$interface = array_merge ($device, $interface);
echo($seperator.generateiflink($interface,makeshortif($interface['ifDescr'])));
while($port = mysql_fetch_array($interfaces)) {
if($_GET['opta']) {
$graph_type = $_GET['opta'];
include("includes/print-port-thumbs.inc.php");
} else {
$port = array_merge ($device, $port);
echo($seperator.generateiflink($port,makeshortif($port['ifDescr'])));
$seperator = ", ";
}
}
echo("</td></tr>");
$x++;