migrate routing/vrf&bgp to new urls

git-svn-id: http://www.observium.org/svn/observer/trunk@2501 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-19 08:54:48 +00:00
parent f7d19e3491
commit 7930814d0d
8 changed files with 82 additions and 57 deletions

View File

@@ -26,7 +26,7 @@ foreach(dbFetchRows("SELECT * FROM `mempools` where `device_id` = ?", array($id)
$rrd_options .= " DEF:mempoolused$i=$rrd_filename:used:AVERAGE ";
$rrd_options .= " CDEF:mempooltotal$i=mempoolused$i,mempoolused$i,mempoolfree$i,+,/,100,* ";
$rrd_optionsb .= " AREA:mempooltotal$i#" . $colour . "10";
$rrd_options .= " AREA:mempooltotal$i#" . $colour . "10";
$rrd_optionsb .= " LINE1:mempooltotal$i#" . $colour . ":'" . $descr . "' ";
$rrd_optionsb .= " GPRINT:mempooltotal$i:MIN:%3.0lf%%";

View File

@@ -13,6 +13,7 @@ foreach ($procs as $proc)
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $descr;
$rrd_list[$i]['rra'] = "usage";
$rrd_list[$i]['area'] = 1;
$i++;
}
}

View File

@@ -36,23 +36,29 @@ foreach ($rrd_list as $rrd)
if ($rrd['invert'])
{
$rrd_options .= " CDEF:".$id."i=".$id.",-1,*";
$rrd_options .= " LINE1.25:".$id."i#".$colour.":'$descr'";
$rrd_optionsb .= " LINE1.25:".$id."i#".$colour.":'$descr'";
$rrd_options .= " AREA:".$id."i#" . $colour . "10";
} else {
$rrd_options .= " LINE1.25:".$id."#".$colour.":'$descr'";
$rrd_optionsb .= " LINE1.25:".$id."#".$colour.":'$descr'";
$rrd_options .= " AREA:".$id."#" . $colour . "10";
}
if(!$basicrrd)
{
$rrd_options .= " GPRINT:".$id.":LAST:%5.2lf%s GPRINT:".$id."min:MIN:%5.2lf%s";
$rrd_options .= " GPRINT:".$id."max:MAX:%5.2lf%s GPRINT:".$id.":AVERAGE:'%5.2lf%s\\n'";
$rrd_optionsb .= " GPRINT:".$id.":LAST:%5.2lf%s GPRINT:".$id."min:MIN:%5.2lf%s";
$rrd_optionsb .= " GPRINT:".$id."max:MAX:%5.2lf%s GPRINT:".$id.":AVERAGE:'%5.2lf%s\\n'";
} else {
$rrd_options .= " GPRINT:".$id.":LAST:%5.2lf%s GPRINT:".$id.":MIN:%5.2lf%s";
$rrd_options .= " GPRINT:".$id.":MAX:%5.2lf%s GPRINT:".$id.":AVERAGE:'%5.2lf%s\\n'";
$rrd_optionsb .= " GPRINT:".$id.":LAST:%5.2lf%s GPRINT:".$id.":MIN:%5.2lf%s";
$rrd_optionsb .= " GPRINT:".$id.":MAX:%5.2lf%s GPRINT:".$id.":AVERAGE:'%5.2lf%s\\n'";
}
$i++; $iter++;
}
$rrd_options .= " HRULE:0#999999";
$rrd_options .= $rrd_optionsb;
$rrd_options .= " HRULE:0#555555";
?>

View File

@@ -11,9 +11,9 @@ echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "<
echo('<td class="list-bold">');
foreach (dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVrf` = ?", array($device['device_id'], $vrf['vrf_id'])) as $port)
{
if ($_GET['optb'] == "graphs")
if ($vars['view'] == "graphs")
{
$graph_type = "port_" . $_GET['optc'];
$graph_type = "port_" . $vars['graph'];
echo("<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: #e9e9e9;'>
<div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>
<a href='device/".$device['device_id']."/port/".$port['interface_id']."/' onmouseover=\"return overlib('\

View File

@@ -40,11 +40,6 @@ $type_text['frequency'] = "Frequency";
$type_text['current'] = "Current";
$type_text['power'] = "Power";
$link_array = array('page' => 'device',
'device' => $device['device_id'],
'tab' => 'health');
print_optionbar_start();
echo("<span style='font-weight: bold;'>Health</span> &#187; ");

View File

@@ -1,5 +1,9 @@
<?php
$link_array = array('page' => 'device',
'device' => $device['device_id'],
'tab' => 'routing');
#$type_text['overview'] = "Overview";
$type_text['ipsec_tunnels'] = "IPSEC Tunnels";
$type_text['bgp'] = "BGP";
@@ -15,25 +19,25 @@ unset($sep);
foreach ($routing_tabs as $type)
{
if (!$_GET['optc']) { $_GET['optc'] = $type; }
if (!$vars['proto']) { $vars['proto'] = $type; }
echo($sep);
if ($_GET['optc'] == $type)
if ($vars['proto'] == $type)
{
echo('<span class="pagemenu-selected">');
}
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/routing/" . $type . "/'> " . $type_text[$type] ." (".$device_routing_count[$type].")</a>");
if ($_GET['optc'] == $type) { echo("</span>"); }
echo(generate_link($type_text[$type] ." (".$device_routing_count[$type].")",$link_array,array('proto'=>$type)));
if ($vars['proto'] == $type) { echo("</span>"); }
$sep = " | ";
}
print_optionbar_end();
if (is_file("pages/device/routing/".mres($_GET['optc']).".inc.php"))
if (is_file("pages/device/routing/".mres($vars['proto']).".inc.php"))
{
include("pages/device/routing/".mres($_GET['optc']).".inc.php");
include("pages/device/routing/".mres($vars['proto']).".inc.php");
} else {
foreach ($routing_tabs as $type)
{

View File

@@ -3,47 +3,55 @@
</div>
<?php
$link_array = array('page' => 'device',
'device' => $device['device_id'],
'tab' => 'routing',
'proto' => 'bgp');
if(!isset($vars['view'])) { $vars['view'] = "basic"; }
print_optionbar_start();
echo("<span style='font-weight: bold;'>BGP</span> &#187; ");
if (!isset($_GET['optb'])) { echo("<span class='pagemenu-selected'>"); }
echo("<a href='device/" . $device['device_id'] . "/routing/bgp/'>Basic</a>");
if (!isset($_GET['optb'])) { echo("</span>"); }
if ($vars['view'] == "basic") { echo("<span class='pagemenu-selected'>"); }
echo(generate_link("Basic", $link_array,array('view'=>'basic')));
if ($vars['view'] == "basic") { echo("</span>"); }
echo(" | ");
if ($_GET['optb'] == "updates") { echo("<span class='pagemenu-selected'>"); }
echo("<a href='device/" . $device['device_id'] . "/routing/bgp/updates/'>Updates</a>");
if ($_GET['optb'] == "updates") { echo("</span>"); }
if ($vars['view'] == "updates") { echo("<span class='pagemenu-selected'>"); }
echo(generate_link("Updates", $link_array,array('view'=>'updates')));
if ($vars['view'] == "updates") { echo("</span>"); }
echo(" | Prefixes: ");
if ($_GET['optb'] == "prefixes_ipv4unicast") { echo("<span class='pagemenu-selected'>"); }
echo("<a href='device/" . $device['device_id'] . "/routing/bgp/prefixes_ipv4unicast/'>IPv4</a>");
if ($_GET['optb'] == "prefixes_ipv4unicast") { echo("</span>"); }
if ($vars['view'] == "prefixes_ipv4unicast") { echo("<span class='pagemenu-selected'>"); }
echo(generate_link("IPv4", $link_array,array('view'=>'prefixes_ipv4unicast')));
if ($vars['view'] == "prefixes_ipv4unicast") { echo("</span>"); }
echo(" | ");
if ($_GET['optb'] == "prefixes_vpnv4unicast") { echo("<span class='pagemenu-selected'>"); }
echo("<a href='device/" . $device['device_id'] . "/routing/bgp/prefixes_vpnv4unicast/'>VPNv4</a>");
if ($_GET['optb'] == "prefixes_vpnv4unicast") { echo("</span>"); }
if ($vars['view'] == "prefixes_vpnv4unicast") { echo("<span class='pagemenu-selected'>"); }
echo(generate_link("VPNv4", $link_array,array('view'=>'prefixes_vpnv4unicast')));
if ($vars['view'] == "prefixes_vpnv4unicast") { echo("</span>"); }
echo(" | ");
if ($_GET['optb'] == "prefixes_ipv6unicast") { echo("<span class='pagemenu-selected'>"); }
echo("<a href='device/" . $device['device_id'] . "/routing/bgp/prefixes_ipv6unicast/'>IPv6</a>");
if ($_GET['optb'] == "prefixes_ipv6unicast") { echo("</span>"); }
if ($vars['view'] == "prefixes_ipv6unicast") { echo("<span class='pagemenu-selected'>"); }
echo(generate_link("IPv6", $link_array,array('view'=>'prefixes_ipv6unicast')));
if ($vars['view'] == "prefixes_ipv6unicast") { echo("</span>"); }
echo(" | Traffic: ");
if ($_GET['optb'] == "macaccounting_bits") { echo("<span class='pagemenu-selected'>"); }
echo("<a href='device/" . $device['device_id'] . "/routing/bgp/macaccounting_bits/'>Bits</a>");
if ($_GET['optb'] == "macaccounting_bits") { echo("</span>"); }
if ($vars['view'] == "macaccounting_bits") { echo("<span class='pagemenu-selected'>"); }
echo(generate_link("Bits", $link_array,array('view'=>'macaccounting_bits')));
if ($vars['view'] == "macaccounting_bits") { echo("</span>"); }
echo(" | ");
if ($_GET['optb'] == "macaccounting_pkts") { echo("<span class='pagemenu-selected'>"); }
echo("<a href='device/" . $device['device_id'] . "/routing/bgp/macaccounting_pkts/'>Packets</a>");
if ($_GET['optb'] == "macaccounting_pkts") { echo("</span>"); }
if ($vars['view'] == "macaccounting_pkts") { echo("<span class='pagemenu-selected'>"); }
echo(generate_link("Packets", $link_array,array('view'=>'macaccounting_pkts')));
if ($vars['view'] == "macaccounting_pkts") { echo("</span>"); }
print_optionbar_end();
@@ -138,22 +146,22 @@ foreach (dbFetchRows("SELECT * FROM `bgpPeers` WHERE `device_id` = ? ORDER BY `b
unset($invalid);
switch ($_GET['optb'])
switch ($vars['view'])
{
case 'prefixes_ipv4unicast':
case 'prefixes_ipv4multicast':
case 'prefixes_ipv4vpn':
case 'prefixes_ipv6unicast':
case 'prefixes_ipv6multicast':
list(,$afisafi) = explode("_", $_GET['optb']);
list(,$afisafi) = explode("_", $vars['view']);
if (isset($peer['afisafi'][$afisafi])) { $peer['graph'] = 1; }
# FIXME no break??
case 'updates':
$graph_array['type'] = "bgp_" . $_GET['optb'];
$graph_array['type'] = "bgp_" . $vars['view'];
$graph_array['id'] = $peer['bgpPeer_id'];
}
switch ($_GET['optb'])
switch ($vars['view'])
{
case 'macaccounting_bits':
case 'macaccounting_pkts':
@@ -163,11 +171,11 @@ foreach (dbFetchRows("SELECT * FROM `bgpPeers` WHERE `device_id` = ? ORDER BY `b
{
$peer['graph'] = 1;
$graph_array['id'] = $acc['ma_id'];
$graph_array['type'] = $_GET['optb'];
$graph_array['type'] = $vars['view'];
}
}
if ($_GET['optb'] == 'updates') { $peer['graph'] = 1; }
if ($vars['view'] == 'updates') { $peer['graph'] = 1; }
if($peer['graph'])
{

View File

@@ -1,8 +1,20 @@
<?php
$link_array = array('page' => 'device',
'device' => $device['device_id'],
'tab' => 'routing',
'proto' => 'vrf');
#echo(generate_link("Basic", $link_array,array('view'=>'basic')));
if(!isset($vars['view'])) { $vars['view'] = "basic"; }
print_optionbar_start();
echo("<span style='font-weight: bold;'>VRFs</span> &#187; ");
$menu_options = array('basic' => 'Basic',
# 'detail' => 'Detail',
);
if (!$_GET['opta']) { $_GET['opta'] = "basic"; }
@@ -10,10 +22,9 @@ if (!$_GET['opta']) { $_GET['opta'] = "basic"; }
$sep = "";
foreach ($menu_options as $option => $text)
{
if ($_GET['optb'] == $option) { echo("<span class='pagemenu-selected'>"); }
echo('<a href="device/' . $device['device_id'] . '/routing/vrf/' . $option . '/">' . $text
. '</a>');
if ($_GET['optb'] == $option) { echo("</span>"); }
if ($vars['view'] == $option) { echo("<span class='pagemenu-selected'>"); }
echo(generate_link($text, $link_array,array('view'=>$option)));
if ($vars['view'] == $option) { echo("</span>"); }
echo(" | ");
}
@@ -30,14 +41,14 @@ $graph_types = array("bits" => "Bits",
foreach ($graph_types as $type => $descr)
{
echo("$type_sep");
if ($_GET['optc'] == $type) { echo("<span class='pagemenu-selected'>"); }
echo('<a href="device/' . $device['device_id'] . '/routing/vrf/graphs/'.$type.'/">'.$descr.'</a>');
if ($_GET['optc'] == $type) { echo("</span>"); }
if ($vars['graph'] == $type) { echo("<span class='pagemenu-selected'>"); }
echo(generate_link($descr, $link_array,array('view'=>'graphs','graph'=>$type)));
if ($vars['graph'] == $type) { echo("</span>"); }
# echo('(');
# if ($_GET['optb'] == $type) { echo("<span class='pagemenu-selected'>"); }
# if ($vars['view'] == $type) { echo("<span class='pagemenu-selected'>"); }
# echo('<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/vrfs/'.$type.'/thumbs/">Mini</a>');
# if ($_GET['optb'] == $type) { echo("</span>"); }
# if ($vars['view'] == $type) { echo("</span>"); }
# echo(')');
$type_sep = " | ";
}