";
}
}
$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_assoc($af_query))
{
$afi = $afisafi['afi'];
$safi = $afisafi['safi'];
$peer_af .= $sep . $config['afi'][$afi][$safi]; ##### CLEAN ME UP, I AM MESSY AND I SMELL OF CHEESE!
$sep = "
";
$valid_afi_safi[$afi][$safi] = 1; ## Build a list of valid AFI/SAFI for this peer
}
unset($sep);
echo("
$i |
" . $peer['bgpPeerIdentifier'] . " ".$peername." |
$peer_type |
" . (isset($peer_af) ? $peer_af : '') . " |
AS" . $peer['bgpPeerRemoteAs'] . " " . $peer['astext'] . " |
" . $peer['bgpPeerAdminStatus'] . " " . $peer['bgpPeerState'] . " |
" .formatUptime($peer['bgpPeerFsmEstablishedTime']). "
Updates " . $peer['bgpPeerInUpdates'] . "
" . $peer['bgpPeerOutUpdates'] . " |
");
if (isset($_GET['opta']) && $_GET['opta'] != "macaccounting")
{
foreach(explode(" ", $_GET['opta']) as $graph_type)
{
if ($graph_type == "prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$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_url = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$day&to=$now&width=500&height=150$afisafi";
$weekly_traffic = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$week&to=$now&width=210&height=100$afisafi";
$weekly_url = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$week&to=$now&width=500&height=150$afisafi";
$monthly_traffic = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$month&to=$now&width=210&height=100$afisafi";
$monthly_url = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$month&to=$now&width=500&height=150$afisafi";
$yearly_traffic = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$year&to=$now&width=210&height=100$afisafi";
$yearly_url = $config['base_url'] . "/graph.php?id=" . $peer['bgpPeer_id'] . "&type=bgp_$graph_type&from=$year&to=$now&width=500&height=150$afisafi";
echo("");
echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> ");
echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> ");
echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> ");
echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> ");
echo(" |
");
}
}
}
if ($_GET['opta'] == "macaccounting" && $has_macaccounting)
{
$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"));
$graph_type = "mac_acc_bits";
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
if (is_file($database))
{
$daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100";
$daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
$weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100";
$weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
$monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100";
$monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
$yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100";
$yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
echo("");
echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
");
echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
");
echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
");
echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
");
echo(" |
");
}
}
$i++;
unset($valid_afi_safi);
}
?>