rename cbgp_prefixes to prefixes, as this will be used for more than cisco-bgp-mib now, and link directly to the bgp tab from the general bgp overview when you click on the device. overloaded generate_device_link, the day/time attributes were never used in any page yet

git-svn-id: http://www.observium.org/svn/observer/trunk@1740 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-11-24 14:25:03 +00:00
parent 79b4e6f114
commit d411f28c33
4 changed files with 7 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
function generate_device_link($device, $text=0, $start=0, $end=0) function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0)
{ {
global $twoday; global $day; global $now; global $config; global $twoday; global $day; global $now; global $config;
if (!$start) { $start = $day; } if (!$start) { $start = $day; }
@ -21,7 +21,7 @@ function generate_device_link($device, $text=0, $start=0, $end=0)
$graphs = $config['os']['default']['over']; $graphs = $config['os']['default']['over'];
} }
$url = $config['base_url']."/device/" . $device['device_id'] . "/"; $url = $config['base_url']."/device/" . $device['device_id'] . "/" . $linksuffix;
$contents = "<div class=list-large>".$device['hostname']; $contents = "<div class=list-large>".$device['hostname'];
if($device['hardware']) { $contents .= " - ".$device['hardware']; } if($device['hardware']) { $contents .= " - ".$device['hardware']; }
$contents .= "</div>"; $contents .= "</div>";
@ -34,7 +34,6 @@ function generate_device_link($device, $text=0, $start=0, $end=0)
# if($device['hardware']) { $contents .= " - ".$device['hardware']; } # if($device['hardware']) { $contents .= " - ".$device['hardware']; }
$contents .= "</div>"; $contents .= "</div>";
# if (isset($device['location'])) { $contents .= "" . htmlentities($device['location'])."<br />"; } # if (isset($device['location'])) { $contents .= "" . htmlentities($device['location'])."<br />"; }
foreach ($graphs as $entry) foreach ($graphs as $entry)
{ {

View File

@ -40,7 +40,7 @@ else
echo("<tr bgcolor=$bg_colour background=$bg_image> echo("<tr bgcolor=$bg_colour background=$bg_image>
<td></td> <td></td>
<td width=150><span class=list-large>" . $peer['bgpLocalAddr'] . "</span><br />".generate_device_link($peer, shorthost($peer['hostname']))."</td> <td width=150><span class=list-large>" . $peer['bgpLocalAddr'] . "</span><br />".generate_device_link($peer, shorthost($peer['hostname']), 'bgp/')."</td>
<td width=30>-></td> <td width=30>-></td>
<td width=150><span class=list-large>" . $peer['bgpPeerIdentifier'] . "</span><br />".$peername."</td> <td width=150><span class=list-large>" . $peer['bgpPeerIdentifier'] . "</span><br />".$peername."</td>
<td width=50><b>$peer_type</b></td> <td width=50><b>$peer_type</b></td>

View File

@ -10,9 +10,9 @@ echo("
<div style='margin: auto; text-align: left; padding-left: 11px; clear: both; display:block; height:20px;'> <div style='margin: auto; text-align: left; padding-left: 11px; clear: both; display:block; height:20px;'>
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/'>No Graphs</a> | <a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/'>No Graphs</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/updates/'>Updates</a> | Prefixes: <a href='".$config['base_url']."/device/" . $_GET['id'] . "/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/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/prefixes/ipv4.vpn/'>VPNv4</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/cbgp_prefixes/ipv6.unicast/'>IPv6</a> <a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/prefixes/ipv6.unicast/'>IPv6</a>
| Traffic: | Traffic:
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/macaccounting/'>Mac Accounting</a> <a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/macaccounting/'>Mac Accounting</a>
</div> </div>
@ -84,7 +84,7 @@ print_optionbar_end();
if (isset($_GET['opta']) && $_GET['opta'] != "macaccounting") { if (isset($_GET['opta']) && $_GET['opta'] != "macaccounting") {
foreach(explode(" ", $_GET['opta']) as $graph_type) { 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 == "prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; }
if($graph_type == "updates" || $valid_afi_safi[$afi][$safi]) { if($graph_type == "updates" || $valid_afi_safi[$afi][$safi]) {
$daily_traffic = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$day&to=$now&width=210&height=100$afisafi"; $daily_traffic = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$day&to=$now&width=210&height=100$afisafi";
$daily_url = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$day&to=$now&width=500&height=150$afisafi"; $daily_url = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$day&to=$now&width=500&height=150$afisafi";