mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
AFI/SAFI tracking for bgp and moving ifgraphs/ifs to ports
git-svn-id: http://www.observium.org/svn/observer/trunk@395 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
<?php
|
||||
|
||||
if($_GET['optb'] == "graphs" || $_GET['opta'] == "graphs") {
|
||||
$graphs = 1;
|
||||
} else {
|
||||
$graphs = 0;
|
||||
}
|
||||
|
||||
echo("
|
||||
<div style='padding: 5px; height: 20px; clear: both; display: block;'>
|
||||
<div style='float: left; font-size: 22px; font-weight: bold;'>Local AS : " . $device['bgpLocalAs'] . "</div>
|
||||
<div style='float: right; text-align: right;'>
|
||||
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/'>No Graphs</a> |
|
||||
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/graphs/'>Graphs</a>
|
||||
<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>
|
||||
</div>
|
||||
</div>");
|
||||
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=1 cellpadding=5 width=100%>");
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$i = "1";
|
||||
$peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier");
|
||||
@@ -33,10 +31,21 @@ echo("
|
||||
|
||||
if($peerhost) { $peername = generatedevicelink($peerhost); } else { unset($peername); }
|
||||
|
||||
$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'];
|
||||
$safi = $afisafi['safi'];
|
||||
$peer_af .= $sep . $config['afi'][$afi][$safi];
|
||||
$sep = "<br />";
|
||||
$valid_afi_safi[$afi][$safi] = 1;
|
||||
}
|
||||
unset($sep);
|
||||
echo("<tr bgcolor=$bg_colour>
|
||||
<td width=20><span class=list-large>$i</span></td>
|
||||
<td><span class=list-large>" . $peer['bgpPeerIdentifier'] . "</span><br />".$peername."</td>
|
||||
<td>$peer_type</td>
|
||||
<td style='font-size: 10px; font-weight: bold; line-height: 10px;'>$peer_af</td>
|
||||
<td><strong>AS" . $peer['bgpPeerRemoteAs'] . "</strong><br />" . $peer['astext'] . "</td>
|
||||
<td><strong><span style='color: $admin_col;'>" . $peer['bgpPeerAdminStatus'] . "<span><br /><span style='color: $col;'>" . $peer['bgpPeerState'] . "</span></strong></td>
|
||||
<td>" .formatUptime($peer['bgpPeerFsmEstablishedTime']). "<br />
|
||||
@@ -44,36 +53,32 @@ echo("
|
||||
<img src='images/16/arrow_up.png' align=absmiddle> " . $peer['bgpPeerOutUpdates'] . "</td></tr>");
|
||||
|
||||
|
||||
if($graphs) {
|
||||
|
||||
$graph_type = "bgpupdates";
|
||||
|
||||
$daily_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=209&height=100";
|
||||
$daily_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
|
||||
$weekly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=209&height=100";
|
||||
$weekly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
|
||||
$monthly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=209&height=100";
|
||||
$monthly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
|
||||
$yearly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=209&height=100";
|
||||
$yearly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
|
||||
if($_GET['opta']) {
|
||||
foreach(explode(" ", $_GET['opta']) as $graph_type) {
|
||||
|
||||
echo("<tr><td colspan=6>");
|
||||
if($graph_type == "cbgp_prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; }
|
||||
|
||||
echo("<a href='?page=interface&id=" . $peer['bgpPeer_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_traffic' border=0></a> ");
|
||||
echo("<a href='?page=interface&id=" . $peer['bgpPeer_id'] . "' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||
<img src='$weekly_traffic' border=0></a> ");
|
||||
echo("<a href='?page=interface&id=" . $peer['bgpPeer_id'] . "' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
|
||||
<img src='$monthly_traffic' border=0></a> ");
|
||||
echo("<a href='?page=interface&id=" . $peer['bgpPeer_id'] . "' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
|
||||
<img src='$yearly_traffic' border=0></a>");
|
||||
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";
|
||||
$weekly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150$afisafi";
|
||||
$monthly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100$afisafi";
|
||||
$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("</td></tr>");
|
||||
|
||||
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> ");
|
||||
echo("<a href='' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"><img src='$monthly_traffic' border=0></a> ");
|
||||
echo("<a href='' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"><img src='$yearly_traffic' border=0></a>");
|
||||
echo("</td></tr>");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
echo("</table></div>");
|
||||
|
@@ -1,16 +1,33 @@
|
||||
<?php
|
||||
echo("
|
||||
<div style='float: right; text-align: right;'>
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifgraphs/bits/'>Bits</a> |
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifgraphs/pkts/'>Packets</a> |
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifgraphs/nupkts/'>NU Packets</a> |
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifgraphs/errors/'>Errors</a>
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/'>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']) { $graph_type = $_GET['opta']; } else { $graph_type = "bits"; }
|
||||
if($_GET['opta'] == graphs ) {
|
||||
if($_GET['optb']) {
|
||||
$graph_type = $_GET['optb'];
|
||||
} else {
|
||||
$graph_type = "bits";
|
||||
}
|
||||
$dographs = 1;
|
||||
}
|
||||
|
||||
include("pages/device/ifs.inc.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>");
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user