netscaler per-vserver page with all graphs.

git-svn-id: http://www.observium.org/svn/observer/trunk@2846 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-01-21 05:51:58 +00:00
parent a9e715a3a9
commit f05c956023
4 changed files with 72 additions and 13 deletions

View File

@@ -21,25 +21,25 @@ unset($sep);
foreach ($loadbalancer_tabs as $type) foreach ($loadbalancer_tabs as $type)
{ {
if (!$vars['proto']) { $vars['proto'] = $type; } if (!$vars['type']) { $vars['type'] = $type; }
echo($sep); echo($sep);
if ($vars['proto'] == $type) if ($vars['type'] == $type)
{ {
echo('<span class="pagemenu-selected">'); echo('<span class="pagemenu-selected">');
} }
echo(generate_link($type_text[$type] ." (".$device_loadbalancer_count[$type].")",$link_array,array('proto'=>$type))); echo(generate_link($type_text[$type] ." (".$device_loadbalancer_count[$type].")",$link_array,array('type'=>$type)));
if ($vars['proto'] == $type) { echo("</span>"); } if ($vars['type'] == $type) { echo("</span>"); }
$sep = " | "; $sep = " | ";
} }
print_optionbar_end(); print_optionbar_end();
if (is_file("pages/device/loadbalancer/".mres($vars['proto']).".inc.php")) if (is_file("pages/device/loadbalancer/".mres($vars['type']).".inc.php"))
{ {
include("pages/device/loadbalancer/".mres($vars['proto']).".inc.php"); include("pages/device/loadbalancer/".mres($vars['type']).".inc.php");
} else { } else {
foreach ($loadbalancer_tabs as $type) foreach ($loadbalancer_tabs as $type)
{ {

View File

@@ -15,7 +15,7 @@ $sep = "";
foreach ($menu_options as $option => $text) foreach ($menu_options as $option => $text)
{ {
if ($_GET['optd'] == $option) { echo("<span class='pagemenu-selected'>"); } if ($_GET['optd'] == $option) { echo("<span class='pagemenu-selected'>"); }
echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/proto=loadbalancer_rservers/' . $option . '/">' . $text echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/type=loadbalancer_rservers/' . $option . '/">' . $text
. '</a>'); . '</a>');
if ($_GET['optd'] == $option) { echo("</span>"); } if ($_GET['optd'] == $option) { echo("</span>"); }
echo(" | "); echo(" | ");
@@ -37,7 +37,7 @@ foreach ($graph_types as $type => $descr)
{ {
echo("$type_sep"); echo("$type_sep");
if ($_GET['opte'] == $type) { echo("<span class='pagemenu-selected'>"); } if ($_GET['opte'] == $type) { echo("<span class='pagemenu-selected'>"); }
echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/proto=loadbalancer_rservers/graphs/'.$type.'/">'.$descr.'</a>'); echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/type=loadbalancer_rservers/graphs/'.$type.'/">'.$descr.'</a>');
if ($_GET['opte'] == $type) { echo("</span>"); } if ($_GET['opte'] == $type) { echo("</span>"); }
$type_sep = " | "; $type_sep = " | ";

View File

@@ -15,7 +15,7 @@ $sep = "";
foreach ($menu_options as $option => $text) foreach ($menu_options as $option => $text)
{ {
if ($_GET['optd'] == $option) { echo("<span class='pagemenu-selected'>"); } if ($_GET['optd'] == $option) { echo("<span class='pagemenu-selected'>"); }
echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/proto=loadbalancer_vservers/' . $option . '/">' . $text echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/type=loadbalancer_vservers/' . $option . '/">' . $text
. '</a>'); . '</a>');
if ($_GET['optd'] == $option) { echo("</span>"); } if ($_GET['optd'] == $option) { echo("</span>"); }
echo(" | "); echo(" | ");
@@ -34,7 +34,7 @@ foreach ($graph_types as $type => $descr)
{ {
echo("$type_sep"); echo("$type_sep");
if ($_GET['opte'] == $type) { echo("<span class='pagemenu-selected'>"); } if ($_GET['opte'] == $type) { echo("<span class='pagemenu-selected'>"); }
echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/proto=loadbalancer_vservers/graphs/'.$type.'/">'.$descr.'</a>'); echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/type=loadbalancer_vservers/graphs/'.$type.'/">'.$descr.'</a>');
if ($_GET['opte'] == $type) { echo("</span>"); } if ($_GET['opte'] == $type) { echo("</span>"); }
$type_sep = " | "; $type_sep = " | ";

View File

@@ -1,11 +1,68 @@
<?php <?php
if(is_numeric($vars['vsvr']))
{
#print_optionbar_start();
#echo("<span style='font-weight: bold;'>VServer</span> &#187; ");
#echo('<a href="'.generate_url($vars, array('vsvr' => NULL)).'">All</a>');
#print_optionbar_end();
$graph_types = array("bits" => "Bits",
"pkts" => "Packets",
"conns" => "Connections",
"reqs" => "Requests",
"hitmiss" => "Hit/Miss");
$i=0;
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
foreach (dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? AND `vsvr_id` = ? ORDER BY `vsvr_name`", array($device['device_id'], $vars['vsvr'])) as $vsvr)
{
if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
if($vsvr['vsvr_state'] == "up") { $vsvr_class="green"; } else { $vsvr_class="red"; }
echo("<tr bgcolor='$bg_colour'>");
echo('<td width=320 class=list-large><a href="'.generate_url($vars, array('vsvr' => $vsvr['vsvr_id'], 'view' => NULL, 'graph' => NULL)).'">' . $vsvr['vsvr_name'] . '</a></td>');
echo("<td width=320 class=list-small>" . $vsvr['vsvr_ip'] . ":" . $vsvr['vsvr_port'] . "</a></td>");
echo("<td width=100 class=list-small><span class='".$vsvr_class."'>" . $vsvr['vsvr_state'] . "</span></td>");
echo("<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_in']*8) . "bps</a></td>");
echo("<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_out']*8) . "bps</a></td>");
echo("</tr>");
foreach($graph_types as $graph_type => $graph_text)
{
$i++;
echo('<tr class="list-bold" bgcolor="'.$bg_colour.'">');
echo('<td colspan="5">');
$graph_type = "netscalervsvr_" . $graph_type;
$graph_array['height'] = "100";
$graph_array['width'] = "213";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $vsvr['vsvr_id'];
$graph_array['type'] = $graph_type;
echo('<h3>'.$graph_text.'</h3>');
include("includes/print-quadgraphs.inc.php");
echo("
</td>
</tr>");
}
}
echo("</table></div>");
} else {
print_optionbar_start(); print_optionbar_start();
echo("<span style='font-weight: bold;'>VServers</span> &#187; "); echo("<span style='font-weight: bold;'>VServers</span> &#187; ");
#$auth = TRUE;
$menu_options = array('basic' => 'Basic', $menu_options = array('basic' => 'Basic',
); );
@@ -49,7 +106,7 @@ foreach (dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? O
if($vsvr['vsvr_state'] == "up") { $vsvr_class="green"; } else { $vsvr_class="red"; } if($vsvr['vsvr_state'] == "up") { $vsvr_class="green"; } else { $vsvr_class="red"; }
echo("<tr bgcolor='$bg_colour'>"); echo("<tr bgcolor='$bg_colour'>");
echo("<td width=320 class=list-large>" . $vsvr['vsvr_name'] . "</a></td>"); echo('<td width=320 class=list-large><a href="'.generate_url($vars, array('vsvr' => $vsvr['vsvr_id'], 'view' => NULL, 'graph' => NULL)).'">' . $vsvr['vsvr_name'] . '</a></td>');
echo("<td width=320 class=list-small>" . $vsvr['vsvr_ip'] . ":" . $vsvr['vsvr_port'] . "</a></td>"); echo("<td width=320 class=list-small>" . $vsvr['vsvr_ip'] . ":" . $vsvr['vsvr_port'] . "</a></td>");
echo("<td width=100 class=list-small><span class='".$vsvr_class."'>" . $vsvr['vsvr_state'] . "</span></td>"); echo("<td width=100 class=list-small><span class='".$vsvr_class."'>" . $vsvr['vsvr_state'] . "</span></td>");
echo("<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_in']*8) . "bps</a></td>"); echo("<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_in']*8) . "bps</a></td>");
@@ -81,4 +138,6 @@ echo("</tr>");
echo("</table></div>"); echo("</table></div>");
}
?> ?>