we now keep port_descr_type as lowercase, to stop mistakes. fixed multiport graphs (old multi_* are now multiport_*). fix customer page and iftype page

git-svn-id: http://www.observium.org/svn/observer/trunk@1485 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2010-07-26 20:04:31 +00:00
parent dbbc160c81
commit 3f2b5982c0
11 changed files with 36 additions and 20 deletions

View File

@ -2,7 +2,7 @@
## Generate a list of ports and then call the multi_bits grapher to generate from the list
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE `ifAlias` LIKE 'Cust: ".mres($_GET['cust'])."%' AND D.device_id = I.device_id");
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = '".mres($_GET['id'])."' AND D.device_id = I.device_id");
while($int = mysql_fetch_array($query)) {
if(is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/" . safename($int['ifIndex'] . ".rrd"))) {
$rrd_filenames[] = $config['rrd_dir'] . "/" . $int['hostname'] . "/" . safename($int['ifIndex'] . ".rrd");

View File

@ -0,0 +1,16 @@
<?
### FIXME
#if(is_numeric($id)) {
# $port = get_port_by_id($id);
# $device = device_by_id_cache($port['device_id']);
#}
#$title = generatedevicelink($device);
#$title .= " :: Port ".generateiflink($port);
$title = "Multi Port :: ";
?>

View File

@ -1,11 +1,8 @@
<?php
if($_GET['port']) { $ports = $_GET['port']; }
if($_GET['ports']) { $ports = $_GET['ports']; }
$i = 1;
foreach(explode(",", $ports) as $ifid) {
foreach(explode(",", $id) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . safename($int[0] . ".rrd"))) {
@ -22,7 +19,7 @@ $colour_line_out = "000099";
$colour_area_in = "CDEB8B";
$colour_area_out = "C3D9FF";
include ("generic_multi_bits.inc.php");
include ("includes/graphs/generic_multi_bits.inc.php");
?>

View File

@ -11,6 +11,8 @@
$if_id = $interface['interface_id'];
print_r($interface);
$interface = ifLabel($interface);
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@ -1,6 +1,6 @@
<?php
$sql = "SELECT * FROM `ports` WHERE `port_descr_type` = 'Cust' GROUP BY `port_descr_descr` ORDER BY `port_descr_descr`";
$sql = "SELECT * FROM `ports` WHERE `port_descr_type` = 'cust' GROUP BY `port_descr_descr` ORDER BY `port_descr_descr`";
$cust_query = mysql_query($sql);
echo("<table border=0 cellspacing=0 cellpadding=2 class=devicetable width=100%>");
@ -23,7 +23,7 @@ while($customer = mysql_fetch_array($cust_query)) {
$i++;
$port_sql = "SELECT * FROM `ports` WHERE `port_descr_type` = 'Cust' AND `port_descr_descr` = '".$customer['port_descr_descr']."'";
$port_sql = "SELECT * FROM `ports` WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = '".$customer['port_descr_descr']."'";
$port_query = mysql_query($port_sql);
$customer_name = $customer['port_descr_descr'];
@ -65,10 +65,10 @@ while($customer = mysql_fetch_array($cust_query)) {
}
echo("<tr bgcolor='$bg_colour'><td></td><td colspan=6>
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($customer['port_descr_descr'])."&type=customer_bits&from=$day&to=$now&width=215&height=100'>
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($customer['port_descr_descr'])."&type=customer_bits&from=$week&to=$now&width=215&height=100'>
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($customer['port_descr_descr'])."&type=customer_bits&from=$month&to=$now&width=215&height=100'>
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($customer['port_descr_descr'])."&type=customer_bits&from=$year&to=$now&width=215&height=100'>
<img src='".$config['base_url']."/graph.php?id=".rawurlencode($customer['port_descr_descr'])."&type=customer_bits&from=$day&to=$now&width=215&height=100'>
<img src='".$config['base_url']."/graph.php?id=".rawurlencode($customer['port_descr_descr'])."&type=customer_bits&from=$week&to=$now&width=215&height=100'>
<img src='".$config['base_url']."/graph.php?id=".rawurlencode($customer['port_descr_descr'])."&type=customer_bits&from=$month&to=$now&width=215&height=100'>
<img src='".$config['base_url']."/graph.php?id=".rawurlencode($customer['port_descr_descr'])."&type=customer_bits&from=$year&to=$now&width=215&height=100'>
</td></tr>");

View File

@ -3,7 +3,7 @@
if( !isset($_GET['optb']) ) { $_GET['optb'] = "graphs"; }
$interface_query = mysql_query("select * from ports WHERE interface_id = '".$_GET['opta']."'");
$interface = mysql_fetch_array($interface_query);
$interface = mysql_fetch_assoc($interface_query);
$port_details = 1;

View File

@ -36,7 +36,7 @@ if($_GET['optc'] == thumbs) {
$sql = "select * from ports WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
$query = mysql_query($sql);
unset ($seperator);
while($interface = mysql_fetch_array($query)) {
while($interface = mysql_fetch_assoc($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('\
@ -59,7 +59,7 @@ if($_GET['optc'] == thumbs) {
echo("<tr><th>Port</th><th>Traffic</th><th>Sync Speed</th><th>Attainable Speed</th><th>Attenuation</th><th>SNR Margin</th><th>Output Powers</th></tr>");
$i = "0";
$interface_query = mysql_query("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = '".$device['device_id']."' AND A.interface_id = P.interface_id AND P.deleted = '0' ORDER BY `ifIndex` ASC");
while($interface = mysql_fetch_array($interface_query)) {
while($interface = mysql_fetch_assoc($interface_query)) {
include("includes/print-interface-adsl.inc.php");
$i++;
}
@ -70,7 +70,7 @@ if($_GET['optc'] == thumbs) {
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "1";
$interface_query = mysql_query("select * from ports WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC");
while($interface = mysql_fetch_array($interface_query)) {
while($interface = mysql_fetch_assoc($interface_query)) {
include("includes/print-interface.inc.php");
$i++;
}

View File

@ -6,12 +6,13 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
$type_where = " (";
foreach(split(",", $_GET['opta']) as $type) {
$type_where .= " $or `ifAlias` like '$type: %' ";
$type_where .= " $or `port_descr_type` = '$type' ";
$or = "OR";
}
$type_where .= ") ";
$sql = "select * from ports as I, devices as D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias";
$sql = "SELECT * FROM `ports` as I, `devices` AS D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias";
$query = mysql_query($sql);
while($interface = mysql_fetch_array($query)) {
$if_list .= $seperator . $interface['interface_id'];
@ -27,7 +28,7 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
<td><span class=list-large>Total Graph for ports of type : ".$types."</span></td></tr>");
echo("<tr bgcolor='$bg'><td>");
$graph_type = "multi_bits";
$graph_type = "multiport_bits";
$interface['interface_id'] = $if_list;
include("includes/print-interface-graphs.inc.php");
echo("</td></tr>");
@ -43,7 +44,7 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
$ifclass = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
echo("<tr bgcolor='$bg'>
<td><span class=list-large>" . generateiflink($interface,$interface['ifAlias']) . "</span><br />
<td><span class=list-large>" . generateiflink($interface,$interface['port_descr_descr']) . "</span><br />
<span class=interface-desc style='float: left;'>".generatedevicelink($interface)." ".generateiflink($interface)." </span>");
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){