mirror of
https://github.com/librenms/librenms.git
synced 2024-09-23 03:18:54 +00:00
improvements to BGP stuff
git-svn-id: http://www.observium.org/svn/observer/trunk@2200 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
a8852e2f72
commit
28558969c4
@ -4,8 +4,6 @@ include("includes/graphs/common.inc.php");
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/". safename("cbgp-" . $data['bgpPeerIdentifier'] . ".".$_GET['afi'].".".$_GET['safi'].".rrd");
|
||||
|
||||
$rra = "AcceptedPrefixes";
|
||||
|
||||
$colour_area = "AA66AA";
|
||||
|
@ -105,7 +105,7 @@ while ($peer = mysql_fetch_assoc($peer_query))
|
||||
|
||||
$af_query = mysql_query("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '".$peer['bgpPeerIdentifier']."'");
|
||||
unset($peer_af);
|
||||
|
||||
unset($sep);
|
||||
while ($afisafi = mysql_fetch_assoc($af_query))
|
||||
{
|
||||
$afi = $afisafi['afi'];
|
||||
|
@ -3,44 +3,56 @@
|
||||
if (!$_GET['opta']) { $_GET['opta'] = "overview"; }
|
||||
if ($_GET['optb'] == "graphs" || $_GET['optc'] == "graphs") { $graphs = "graphs"; } else { $graphs = "nographs"; }
|
||||
|
||||
print_optionbar_start('', '');
|
||||
$datas[] = 'overview';
|
||||
|
||||
echo('<span style="font-weight: bold;">Routing</span> » ');
|
||||
$vrf_count = @mysql_result(mysql_query("SELECT COUNT(*) FROM `vrfs`"), 0);
|
||||
if($vrf_count) { $datas[] = 'vrf'; }
|
||||
|
||||
if ($_GET['opta'] == "overview") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/overview/'.$graphs.'/">Overview</a>');
|
||||
if ($_GET['opta'] == "overview") { echo("</span>"); }
|
||||
$bgp_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `bgpPeers`"), 0);
|
||||
if ($bgp_count) { $datas[] = 'bgp'; }
|
||||
|
||||
echo(" | ");
|
||||
$cef_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `cef_switching`"), 0);
|
||||
if ($cef_count) { $datas[] = 'cef'; }
|
||||
|
||||
## Start BGP Menu -- FIXME only show if BGP enabled?
|
||||
if ($_GET['opta'] == "bgp") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/all/'.$graphs.'/">BGP</a>');
|
||||
if ($_GET['opta'] == "bgp") { echo("</span>"); }
|
||||
$ospf_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_instances`"), 0);
|
||||
if ($ospf_count) { $datas[] = 'ospf'; }
|
||||
|
||||
echo(" | ");
|
||||
$type_text['overview'] = "Overview";
|
||||
$type_text['bgp'] = "BGP";
|
||||
$type_text['cef'] = "CEF";
|
||||
$type_text['ospf'] = "OSPF";
|
||||
$type_text['vrf'] = "VRFs";
|
||||
|
||||
## Start OSPF Menu -- FIXME only show if BGP enabled?
|
||||
if ($_GET['opta'] == "ospf") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/ospf/all/'.$graphs.'/">OSPF</a>');
|
||||
if ($_GET['opta'] == "ospf") { echo("</span>"); }
|
||||
print_optionbar_start();
|
||||
|
||||
echo(" | ");
|
||||
if (!$_GET['opta']) { $_GET['opta'] = "overview"; }
|
||||
|
||||
## Start VRF Menu -- FIXME only show if BGP enabled?
|
||||
if ($_GET['opta'] == "vrf") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/vrf/all/'.$graphs.'/">VRF</a>');
|
||||
if ($_GET['opta'] == "vrf") { echo("</span>"); }
|
||||
echo("<span style='font-weight: bold;'>Routing</span> » ");
|
||||
|
||||
unset($sep);
|
||||
foreach ($datas as $type)
|
||||
{
|
||||
echo($sep);
|
||||
|
||||
if ($_GET['opta'] == $type)
|
||||
{
|
||||
echo('<span class="pagemenu-selected">');
|
||||
}
|
||||
|
||||
print_optionbar_end('', '');
|
||||
echo("<a href='routing/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $type_text[$type] ."</a>");
|
||||
if ($_GET['opta'] == $type) { echo("</span>"); }
|
||||
$sep = " | ";
|
||||
}
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
switch ($_GET['opta'])
|
||||
{
|
||||
case 'overview':
|
||||
case 'bgp':
|
||||
case 'vrf':
|
||||
case 'cef':
|
||||
case 'ospf':
|
||||
include('pages/routing/'.$_GET['opta'].'.inc.php');
|
||||
break;
|
||||
default:
|
||||
|
@ -11,6 +11,8 @@ else
|
||||
|
||||
echo('<span style="font-weight: bold;">BGP</span> » ');
|
||||
|
||||
if(!$_GET['optb']) { $_GET['optb'] = "all"; }
|
||||
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optb'] == "all") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/all/'.$graphs.'/">All</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optb'] == "all") { echo("</span>"); }
|
||||
@ -34,42 +36,52 @@ else
|
||||
echo('');
|
||||
## End BGP Menu
|
||||
|
||||
if(!isset($graphs)) { $graphs == "nographs"; }
|
||||
|
||||
echo('<div style="float: right;">');
|
||||
|
||||
if ($graphs == "graphs") { echo('<span class="pagemenu-selected">'); }
|
||||
if(!$_GET['optc']) { $_GET['optc'] = "nographs"; }
|
||||
|
||||
if(!isset($_GET['optc']))
|
||||
{
|
||||
echo('<a href="routing/'. $_GET['opta'].'/graphs/"> Graphs</a>');
|
||||
} else {
|
||||
echo('<a href="routing/'. $_GET['opta'].'/'.$_GET['optb'].'/graphs/"> Graphs</a>');
|
||||
}
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "nographs") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/nographs/">No Graphs</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "nographs") { echo("</span>"); }
|
||||
echo(" | ");
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "updates") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/updates/">Updates</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "updates") { echo("</span>"); }
|
||||
|
||||
if ($graphs == "graphs")
|
||||
{
|
||||
echo('</span>');
|
||||
}
|
||||
echo(" | Prefixes: Unicast (");
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv4unicast") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/prefixes_ipv4unicast/">IPv4</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv4unicast") { echo("</span>"); }
|
||||
echo("|");
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv6unicast") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/prefixes_ipv6unicast/">IPv6</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv6unicast") { echo("</span>"); }
|
||||
echo("|");
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv4vpn") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/prefixes_ipv4vpn/">VPNv4</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv4vpn") { echo("</span>"); }
|
||||
echo(")");
|
||||
|
||||
echo(' | ');
|
||||
echo(" | Multicast (");
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv4multicast") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/prefixes_ipv4multicast/">IPv4</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv4multicast") { echo("</span>"); }
|
||||
echo("|");
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv6multicast") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/prefixes_ipv6multicast/">IPv6</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "prefixes_ipv6multicast") { echo("</span>"); }
|
||||
echo(")");
|
||||
|
||||
if ($graphs == "nographs")
|
||||
{
|
||||
echo('<span class="pagemenu-selected">');
|
||||
}
|
||||
echo(" | MAC (");
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "macaccounting_bits") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/macaccounting_bits/">Bits</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "macaccounting_bits") { echo("</span>"); }
|
||||
echo("|");
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "macaccounting_pkts") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="routing/bgp/'.$_GET['optb'].'/macaccounting_pkts/">Packets</a>');
|
||||
if ($_GET['opta'] == "bgp" && $_GET['optc'] == "macaccounting_pkts") { echo("</span>"); }
|
||||
echo(")");
|
||||
|
||||
if(!isset($_GET['optc']))
|
||||
{
|
||||
echo('<a href="routing/'. $_GET['opta'].'/nographs/"> No Graphs</a>');
|
||||
} else {
|
||||
echo('<a href="routing/'. $_GET['opta'].'/'.$_GET['optb'].'/nographs/"> No Graphs</a>');
|
||||
}
|
||||
|
||||
if ($graphs == "nographs")
|
||||
{
|
||||
echo('</span>');
|
||||
}
|
||||
|
||||
echo('</div>');
|
||||
|
||||
@ -77,7 +89,7 @@ else
|
||||
|
||||
|
||||
echo("<table border=0 cellspacing=0 cellpadding=5 width=100% class='sortable'>");
|
||||
echo('<tr style="height: 30px"><td width=1></td><th>Local address</th><th></th><th>Peer address</th><th>Type</th><th>Remote AS</th><th>State</th><th>Uptime</th></tr>');
|
||||
echo('<tr style="height: 30px"><td width=1></td><th>Local address</th><th></th><th>Peer address</th><th>Type</th><th>Family</th><th>Remote AS</th><th>State</th><th width=200>Uptime / Updates</th></tr>');
|
||||
|
||||
$i = "1";
|
||||
|
||||
@ -122,11 +134,28 @@ else
|
||||
|
||||
echo('<tr bgcolor="'.$bg_colour.'"' . ($peer['alert'] ? ' bordercolor="#cc0000"' : '') . ($peer['disabled'] ? ' bordercolor="#cccccc"' : '') . ">");
|
||||
|
||||
$af_query = mysql_query("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = '".$peer['device_id']."' AND bgpPeerIdentifier = '".$peer['bgpPeerIdentifier']."'");
|
||||
|
||||
unset($sep);
|
||||
while ($afisafi = mysql_fetch_assoc($af_query))
|
||||
{
|
||||
$afi = $afisafi['afi'];
|
||||
$safi = $afisafi['safi'];
|
||||
$this_afisafi = $afi.$safi;
|
||||
#$peer['afi'] .= $sep . $config['afi'][$afi][$safi]; ##### CLEAN ME UP, I AM MESSY AND I SMELL OF CHEESE! FIXME!
|
||||
$peer['afi'] .= $sep . $afi .".".$safi;
|
||||
$sep = "<br />";
|
||||
$peer['afisafi'][$this_afisafi] = 1; ## Build a list of valid AFI/SAFI for this peer
|
||||
}
|
||||
unset($sep);
|
||||
|
||||
|
||||
echo(" <td></td>
|
||||
<td width=150>" . $localaddresslink . "<br />".generate_device_link($peer, shorthost($peer['hostname']), 'routing/bgp/')."</td>
|
||||
<td width=30>-></td>
|
||||
<td width=150>" . $peeraddresslink . "</td>
|
||||
<td width=50><b>$peer_type</b></td>
|
||||
<td width=50>".$peer['afi']."</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 />
|
||||
@ -134,18 +163,46 @@ else
|
||||
<img src='images/16/arrow_up.png' align=absmiddle /> " . format_si($peer['bgpPeerOutUpdates']) . "</td></tr>");
|
||||
|
||||
|
||||
if($graphs == "graphs")
|
||||
unset($invalid);
|
||||
switch ($_GET['optc'])
|
||||
{
|
||||
case 'prefixes_ipv4unicast':
|
||||
case 'prefixes_ipv4multicast':
|
||||
case 'prefixes_ipv4vpn':
|
||||
case 'prefixes_ipv6unicast':
|
||||
case 'prefixes_ipv6multicast':
|
||||
list(,$afisafi) = explode("_", $_GET['optc']);
|
||||
if (isset($peer['afisafi'][$afisafi])) { $peer['graph'] = 1; }
|
||||
case 'updates':
|
||||
$graph_array['type'] = "bgp_" . $_GET['optc'];
|
||||
$graph_array['id'] = $peer['bgpPeer_id'];
|
||||
}
|
||||
|
||||
switch ($_GET['optc'])
|
||||
{
|
||||
case 'macaccounting_bits':
|
||||
case 'macaccounting_pkts':
|
||||
$acc = mysql_fetch_assoc(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M, ports AS P WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id"));
|
||||
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
if (is_array($acc) && is_file($database))
|
||||
{
|
||||
$peer['graph'] = 1;
|
||||
$graph_array['id'] = $acc['ma_id'];
|
||||
$graph_array['type'] = $_GET['optc'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET['optc'] == 'updates') { $peer['graph'] = 1; }
|
||||
|
||||
if($peer['graph'])
|
||||
{
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "216";
|
||||
$graph_array['width'] = "220";
|
||||
$graph_array['to'] = $now;
|
||||
$graph_array['id'] = $peer['bgpPeer_id'];
|
||||
$graph_array['type'] = "bgp_updates";
|
||||
|
||||
echo('<tr bgcolor="'.$bg_colour.'"' . ($bg_image ? ' background="'.$bg_image.'"' : '') . '"><td colspan="8">');
|
||||
|
||||
# $graph_array['type'] = "bgp_" . $_GET['optc'];
|
||||
# $graph_array['id'] = $peer['bgpPeer_id'];
|
||||
echo('<tr bgcolor="'.$bg_colour.'"' . ($bg_image ? ' background="'.$bg_image.'"' : '') . '"><td colspan="9">');
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
echo("</td></tr>");
|
||||
}
|
||||
|
||||
|
0
html/pages/routing/cef.inc.php
Normal file
0
html/pages/routing/cef.inc.php
Normal file
0
html/pages/routing/ospf.inc.php
Normal file
0
html/pages/routing/ospf.inc.php
Normal file
26
html/pages/routing/overview.inc.php
Normal file
26
html/pages/routing/overview.inc.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
foreach ($datas as $type)
|
||||
{
|
||||
if($type != "overview")
|
||||
{
|
||||
if(is_file("pages/routing/overview/".mres($type).".inc.php")) {
|
||||
|
||||
$g_i++;
|
||||
if (!is_integer($g_i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
echo('<div style="background-color: '.$row_colour.';">');
|
||||
echo('<div style="padding:4px 0px 0px 8px;"><span class=graphhead>'.$type_text[$type].'</span>');
|
||||
include("pages/routing/overview/".mres($type).".inc.php");
|
||||
echo('</div>');
|
||||
echo('</div>');
|
||||
} else {
|
||||
$graph_title = $type_text[$type];
|
||||
$graph_type = "device_".$type;
|
||||
include("includes/print-device-graph.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -0,0 +1,13 @@
|
||||
|
||||
<?php
|
||||
|
||||
$total = mysql_result(mysql_query("SELECT count(*) FROM `bgpPeers`"),0);
|
||||
$up = mysql_result(mysql_query("SELECT count(*) FROM `bgpPeers` WHERE `bgpPeerState` = 'established'"),0);
|
||||
$stop = mysql_result(mysql_query("SELECT count(*) FROM `bgpPeers` WHERE `bgpPeerAdminStatus` = 'stop'"),0);
|
||||
|
||||
echo('
|
||||
<div>
|
||||
<span style="device-list">Sessions: '.$total.' Up: '.$up.' Down: '.($total-$up) . ($stop != 0 ? ' ( Shutdown: '.$stop.' )' : '') . '</span>
|
||||
</div>');
|
||||
|
||||
?>
|
@ -12,6 +12,7 @@ $config['afi']['ipv4']['multiicast'] = "IPv4 Multicast";
|
||||
$config['afi']['ipv4']['vpn'] = "VPNv4";
|
||||
$config['afi']['ipv6']['unicast'] = "IPv6";
|
||||
$config['afi']['ipv6']['multicast'] = "IPv6 Multicast";
|
||||
$config['afi']['ipv4']['vpn'] = "VPNv6";
|
||||
|
||||
$config['os']['default']['over'][0]['graph'] = "device_processor";
|
||||
$config['os']['default']['over'][0]['text'] = "Processor Usage";
|
||||
|
Loading…
Reference in New Issue
Block a user