many updates to BGP and interface printing

git-svn-id: http://www.observium.org/svn/observer/trunk@396 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-03-30 11:20:18 +00:00
parent f032b883d6
commit 1a514e4cd4
16 changed files with 1422 additions and 154 deletions

View File

@@ -19,8 +19,8 @@ RewriteRule ^interfaces/(.+)/ ?page=interfaces&type=$1
RewriteRule ^bill/([0-9]+) ?page=bills&bill=$1
RewriteRule ^device/([0-9]+)/([a-z]+)/([a-z]+)/([a-z|0-9]+)/ ?page=device&id=$1&section=$2&opta=$3&optb=$4
RewriteRule ^device/([0-9]+)/([a-z]+)/([a-z|0-9]+)/ ?page=device&id=$1&section=$2&opta=$3
RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/ ?page=device&id=$1&section=$2&opta=$3&optb=$4
RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/ ?page=device&id=$1&section=$2&opta=$3
RewriteRule ^device/([0-9]+)/([a-z]+)/ ?page=device&id=$1&section=$2
RewriteRule ^device/([0-9]+) ?page=device&id=$1

21
html/css/mktree.css Normal file
View File

@@ -0,0 +1,21 @@
/* Put this inside a @media qualifier so Netscape 4 ignores it */
@media screen, print {
/* Turn off list bullets */
ul.mktree li { list-style: none; }
/* Control how "spaced out" the tree is */
ul.mktree, ul.mktree ul , ul.mktree li { margin-left:10px; padding:0px; }
/* Provide space for our own "bullet" inside the LI */
ul.mktree li .bullet { padding-left: 15px; }
/* Show "bullets" in the links, depending on the class of the LI that the link's in */
ul.mktree li.liOpen .bullet { cursor: pointer; background: url(../images/minus.gif) center left no-repeat; }
ul.mktree li.liClosed .bullet { cursor: pointer; background: url(../images/plus.gif) center left no-repeat; }
ul.mktree li.liBullet .bullet { cursor: default; background: url(../images/bullet.gif) center left no-repeat; }
/* Sublists are visible or not based on class of parent LI */
ul.mktree li.liOpen ul { display: block; }
ul.mktree li.liClosed ul { display: none; }
/* Format menu items differently depending on what level of the tree they are in */
ul.mktree li { font-size: 12pt; }
ul.mktree li ul li { font-size: 10pt; }
ul.mktree li ul li ul li { font-size: 10pt; }
ul.mktree li ul li ul li ul li { font-size: 10pt; }
}

View File

@@ -11,12 +11,10 @@
include("includes/authenticate.inc");
if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }
if($_GET['params']) {
list($_GET['host'], $_GET['if'], $_GET['from'], $_GET['to'], $_GET['width'], $_GET['height'], $_GET['title'], $_GET['vertical'], $_GET['type'], $_GET['interfaces']) = explode("||", mcrypt_ecb(MCRYPT_DES, $key_value, $_GET['params'], MCRYPT_DECRYPT));
}
if($_GET['host']) {
$device_id = $_GET['host'];
} elseif($_GET['device']) {
@@ -28,16 +26,9 @@
$device_id = getpeerhost($_GET['peer']);
}
if($_GET['legend']) {
$legend = $_GET['legend'];
}
if($_GET['inverse']) {
$inverse = $_GET['inverse'];
}
if($device_id) {
$hostname = gethostbyid($device_id);
}
if($_GET['legend']) { $legend = $_GET['legend']; }
if($_GET['inverse']) { $inverse = $_GET['inverse']; }
if($device_id) { $hostname = gethostbyid($device_id); }
$from = $_GET['from'];
$to = $_GET['to'];
@@ -92,7 +83,7 @@
$graph = graph_mac_acc ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'device_bits':
$graph = graph_device_bits ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
$graph = graph_device_bits ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
break;
case 'bits':
$graph = graph_bits ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
@@ -115,10 +106,14 @@
case 'unixfs':
$graph = unixfsgraph ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'bgpupdates':
case 'bgp_updates':
$bgpPeerIdentifier = mysql_result(mysql_query("SELECT bgpPeerIdentifier FROM bgpPeers WHERE bgpPeer_id = '".$_GET['peer']."'"),0);
$graph = bgpupdatesgraph ($hostname . "/bgp-" . $bgpPeerIdentifier . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'cbgp_prefixes':
$bgpPeerIdentifier = mysql_result(mysql_query("SELECT bgpPeerIdentifier FROM bgpPeers WHERE bgpPeer_id = '".$_GET['peer']."'"),0);
$graph = graph_cbgp_prefixes ($hostname . "/cbgp-" . $bgpPeerIdentifier . ".".$_GET['afi'].".".$_GET['safi'].".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'calls':
$graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
@@ -225,7 +220,9 @@
$graph = apachebitsgraphUnix ($hostname . "/apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
}
break;
default:
echo("INCORRECT GRAPH TYPE");
exit;
}
if($graph) {
@@ -233,7 +230,13 @@
echo(`cat graphs/$graphfile`);
} else {
header('Content-type: image/png');
echo(`cat images/no-graph.png`);
$string = "Graph Generation Error";
$im = imagecreate($width, $height);
$orange = imagecolorallocate($im, 255, 255, 255);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
imagepng($im);
imagedestroy($im);
}
$delete = `rm graphs/$graphfile`;

View File

@@ -19,7 +19,8 @@
$ifHardType = $interface['ifHardType'];
if($ifAlias) {$ifAlias = $ifAlias . "</br>";}
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
#if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
if($bg == "#e5e5e5") { $bg = "#ffffff"; } else { $bg="#e5e5e5"; }
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);

View File

@@ -68,15 +68,16 @@ if($config['enable_bgp'] && $device['bgpLocalAs']) {
if(@mysql_result(mysql_query("select count(interface_id) from interfaces WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
echo("
<li class=" . $select['ifs'] . ">
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifs/'>
<img src='images/16/server_link.png' align=absmiddle border=0> Ports
</a>
</li>
<li class=" . $select['ifgraphs'] . ">
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifgraphs/'>
<img src='images/16/port_graphs.png' align=absmiddle border=0> Port Graphs
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/'>
<img src='images/16/connect.png' align=absmiddle border=0> Ports
</a>
</li>");
#<li class=" . $select['ifgraphs'] . ">
# <a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifgraphs/'>
# <img src='images/16/port_graphs.png' align=absmiddle border=0> Port Graphs
# </a>
#</li>");
}
if($_SESSION[userlevel] >= "5") {

View File

@@ -9,7 +9,7 @@ echo("
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/bgp_updates/'>Updates</a> | Prefixes:
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/cbgp_prefixes/ipv4.unicast/'>IPv4</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/cbgp_prefixes/ipv4.vpn/'>VPNv4</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/cbgp_updates/ipv6.unicast/'>IPv6</a>
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/cbgp_prefixes/ipv6.unicast/'>IPv6</a>
</div>
</div>");
@@ -34,11 +34,11 @@ echo("
$af_query = mysql_query("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '".$peer['bgpPeerIdentifier']."'");
unset($peer_af);
while($afisafi = mysql_fetch_array($af_query)) {
$afi = $afisafi['afi'];
$afi = $afisafi['afi'];
$safi = $afisafi['safi'];
$peer_af .= $sep . $config['afi'][$afi][$safi];
$peer_af .= $sep . $config['afi'][$afi][$safi]; ##### CLEAN ME UP, I AM MESSY AND I SMELL OF CHEESE!
$sep = "<br />";
$valid_afi_safi[$afi][$safi] = 1;
$valid_afi_safi[$afi][$safi] = 1; ## Build a list of valid AFI/SAFI for this peer
}
unset($sep);
echo("<tr bgcolor=$bg_colour>
@@ -55,11 +55,8 @@ echo("
if($_GET['opta']) {
foreach(explode(" ", $_GET['opta']) as $graph_type) {
if($graph_type == "cbgp_prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; }
if($graph_type == "bgp_updates" || $valid_afi_safi[$afi][$safi]) {
$daily_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100$afisafi";
$daily_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150$afisafi";
$weekly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100$afisafi";
@@ -68,7 +65,6 @@ echo("
$monthly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150$afisafi";
$yearly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100$afisafi";
$yearly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150$afisafi";
echo("<tr bgcolor=$bg_colour><td colspan=7>");
echo("<a href='' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"><img src='$daily_traffic' border=0></a> ");
echo("<a href='' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"><img src='$weekly_traffic' border=0></a> ");

View File

@@ -1,13 +0,0 @@
<?php
$hostname = gethostbyid($device['device_id']);
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "1";
$interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifDescr` ASC");
while($interface = mysql_fetch_array($interface_query)) {
include("includes/print-interface.inc");
}
echo("</table></div>");
?>

View File

@@ -1,16 +1,13 @@
<?php
echo("
<div style='float: right; text-align: right;'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/'>Details</a> | Graphs:
<div style='float: right; text-align: right; padding-bottom: 10px'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/'>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/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/errors/'>Errors</a>
</div>");
$dographs = 1;
if($_GET['opta'] == graphs ) {
if($_GET['optb']) {
$graph_type = $_GET['optb'];