From a04e4b9faeee9cf40c0fa5d6bc96bc841823c3a5 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Mon, 18 Apr 2011 16:56:51 +0000 Subject: [PATCH] prettier BGP git-svn-id: http://www.observium.org/svn/observer/trunk@2098 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/routing.inc.php | 60 +++---------------------- html/pages/routing/bgp.inc.php | 82 ++++++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 59 deletions(-) diff --git a/html/pages/routing.inc.php b/html/pages/routing.inc.php index b13101b652..6892188a1b 100644 --- a/html/pages/routing.inc.php +++ b/html/pages/routing.inc.php @@ -5,6 +5,8 @@ if ($_GET['optb'] == "graphs" || $_GET['optc'] == "graphs") { $graphs = "graphs" print_optionbar_start('', ''); + echo('Routing » '); + if ($_GET['opta'] == "overview") { echo(""); } echo('Overview'); if ($_GET['opta'] == "overview") { echo(""); } @@ -12,64 +14,12 @@ print_optionbar_start('', ''); echo(" | "); ## Start BGP Menu -- FIXME only show if BGP enabled? - if ($_GET['opta'] == "bgp" && $_GET['optb'] == "all") { echo(""); } + if ($_GET['opta'] == "bgp") { echo(""); } echo('BGP'); - if ($_GET['opta'] == "bgp" && $_GET['optb'] == "all") { echo(""); } - echo('('); - if ($_GET['opta'] == "bgp" && $_GET['optb'] == "internal") { echo(""); } - echo('Internal'); - if ($_GET['opta'] == "bgp" && $_GET['optb'] == "internal") { echo(""); } - echo("|"); - if ($_GET['opta'] == "bgp" && $_GET['optb'] == "external") { echo(""); } - echo('External'); - if ($_GET['opta'] == "bgp" && $_GET['optb'] == "external") { echo(""); } - echo(')'); - ## End BGP Menu + if ($_GET['opta'] == "bgp") { echo(""); } -if(!isset($graphs)) { $graphs == "nographs"; } - -echo('
'); - -if ($graphs == "graphs") -{ - echo(''); -} - -if(isset($_GET['optc'])) -{ - echo(' Graphs'); -} else { - echo(' Graphs'); -} - -if ($graphs == "graphs") -{ - echo(''); -} - -echo(' | '); - -if ($graphs == "nographs") -{ - echo(''); -} - -if(isset($_GET['optc'])) -{ - echo(' No Graphs'); -} else { - echo(' No Graphs'); -} - -if ($graphs == "nographs") -{ - echo(''); -} - -echo('
'); - -print_optionbar_end(); +print_optionbar_end('', ''); switch ($_GET['opta']) { diff --git a/html/pages/routing/bgp.inc.php b/html/pages/routing/bgp.inc.php index cca4245c28..55298dab9b 100644 --- a/html/pages/routing/bgp.inc.php +++ b/html/pages/routing/bgp.inc.php @@ -6,7 +6,78 @@ if ($_SESSION['userlevel'] < '5') } else { - echo("
"); + + print_optionbar_start('', ''); + + echo('BGP » '); + + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "all") { echo(""); } + echo('All'); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "all") { echo(""); } + echo(' | '); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "internal") { echo(""); } + echo('Internal'); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "internal") { echo(""); } + echo(" | "); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "external") { echo(""); } + echo('External'); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "external") { echo(""); } + echo(" | "); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "disabled") { echo(""); } + echo('Disabled'); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "disabled") { echo(""); } + echo(" | "); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "alerts") { echo(""); } + echo('Alerts'); + if ($_GET['opta'] == "bgp" && $_GET['optb'] == "alerts") { echo(""); } + + echo(''); + ## End BGP Menu + + if(!isset($graphs)) { $graphs == "nographs"; } + + echo('
'); + + if ($graphs == "graphs") { echo(''); } + + if(!isset($_GET['optc'])) + { + echo(' Graphs'); + } else { + echo(' Graphs'); + } + + if ($graphs == "graphs") + { + echo(''); + } + + echo(' | '); + + if ($graphs == "nographs") + { + echo(''); + } + + if(!isset($_GET['optc'])) + { + echo(' No Graphs'); + } else { + echo(' No Graphs'); + } + + if ($graphs == "nographs") + { + echo(''); + } + + echo('
'); + + print_optionbar_end(); + + + echo("
"); + echo("
"); echo(''); $i = "1"; @@ -14,6 +85,8 @@ else if ($_GET['optb'] == "alerts") { $where = "AND (B.bgpPeerAdminStatus = 'start' or B.bgpPeerAdminStatus = 'running') AND B.bgpPeerState != 'established'"; + } elseif ($_GET['optb'] == "disabled") { + $where = "AND B.bgpPeerAdminStatus = 'stop'"; } elseif ($_GET['optb'] == "external") { $where = "AND D.bgpLocalAs != B.bgpPeerRemoteAs"; } elseif ($_GET['optb'] == "internal") { @@ -27,9 +100,9 @@ else if (!is_integer($i/2)) { $bg_colour = $list_colour_b; } else { $bg_colour = $list_colour_a; } - if ($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; if ($_GET['optb'] != "alerts") { $alert=1; $bg_image = "images/1px-pink.png"; } } + if ($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; $peer['alert']=1; } if ($peer['bgpPeerAdminStatus'] == "start" || $peer['bgpPeerAdminStatus'] == "running") { $admin_col = "green"; } else { $admin_col = "gray"; } - + if ($peer['bgpPeerAdminStatus'] == "stop") { $peer['alert']=0; $peer['disabled']=1; } if ($peer['bgpPeerRemoteAs'] == $peer['bgpLocalAs']) { $peer_type = "iBGP"; } else { $peer_type = "eBGP"; if ($peer['bgpPeerRemoteAS'] >= '64512' && $peer['bgpPeerRemoteAS'] <= '65535') { $peer_type = "Priv eBGP"; } } @@ -48,7 +121,8 @@ else $peer_daily_url = "graph.php?id=" . $peer['bgpPeer_id'] . "&type=" . $graph_type . "&from=$day&to=$now&width=500&height=150"; $peeraddresslink = "', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">" . $peer['bgpPeerIdentifier'] . ""; - echo(' + echo('
Local addressPeer addressTypeRemote ASStateUptime
" . $localaddresslink . "
".generate_device_link($peer, shorthost($peer['hostname']), 'routing/bgp/')."
->