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"; 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") { $where = "AND D.bgpLocalAs = B.bgpPeerRemoteAs"; } $peer_query = mysql_query("select * from bgpPeers AS B, devices AS D WHERE B.device_id = D.device_id $where ORDER BY D.hostname, B.bgpPeerRemoteAs, B.bgpPeerIdentifier"); while ($peer = mysql_fetch_assoc($peer_query)) { unset ($alert, $bg_image); 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"; $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"; } } $peerhost = mysql_fetch_assoc(mysql_query("SELECT * FROM ipaddr AS A, ports AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); if ($peerhost) { $peername = generate_device_link($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); } // display overlib graphs $graph_type = "bgp_prefixes"; $local_daily_url = "graph.php?id=" . $peer['bgpPeer_id'] . "&type=" . $graph_type . "&from=$day&to=$now&width=500&height=150&&afi=ipv4&safi=unicast"; $localaddresslink = "', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">" . $peer['bgpLocalAddr'] . ""; $graph_type = "bgp_updates"; $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('"); if($graphs == "graphs") { $graph_array['height'] = "100"; $graph_array['width'] = "215"; $graph_array['to'] = $now; $graph_array['id'] = $peer['bgpPeer_id']; $graph_array['type'] = "bgp_updates"; echo('"); } $i++; } echo("
Local addressPeer addressTypeRemote ASStateUptime
" . $localaddresslink . "
".generate_device_link($peer, shorthost($peer['hostname']), 'routing/bgp/')."
-> " . $peeraddresslink . " $peer_type AS" . $peer['bgpPeerRemoteAs'] . "
" . $peer['astext'] . "
" . $peer['bgpPeerAdminStatus'] . "
" . $peer['bgpPeerState'] . "
" .formatUptime($peer['bgpPeerFsmEstablishedTime']). "
Updates " . format_si($peer['bgpPeerInUpdates']) . " " . format_si($peer['bgpPeerOutUpdates']) . "
'); include("includes/print-quadgraphs.inc.php"); echo("
"); } ?>