Skip to content

Commit

Permalink
Cisco ACE support thanks to wez_db
Browse files Browse the repository at this point in the history
git-svn-id: http://www.observium.org/svn/observer/trunk@2814 61d68cd4-352d-0410-923a-c4978735b2b8
  • Loading branch information
adama committed Jan 12, 2012
1 parent c4972c1 commit 6a29f36
Show file tree
Hide file tree
Showing 22 changed files with 15,929 additions and 3 deletions.
3 changes: 3 additions & 0 deletions database-update.sql
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
ALTER TABLE `bills` CHANGE `bill_cdr` `bill_cdr` BIGINT( 20 ) NULL DEFAULT NULL;
CREATE TABLE IF NOT EXISTS `loadbalancer_rservers` ( `rserver_id` int(11) NOT NULL AUTO_INCREMENT, `farm_id` varchar(128) CHARACTER SET utf8 NOT NULL, `device_id` int(11) NOT NULL, `StateDescr` varchar(64) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`rserver_id`)) ENGINE=MyISAM AUTO_INCREMENT=514 DEFAULT CHARSET=utf8
CREATE TABLE IF NOT EXISTS `loadbalancer_vservers` ( `classmap_id` int(11) NOT NULL, `classmap` varchar(128) NOT NULL, `serverstate` varchar(64) NOT NULL, `device_id` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8

20 changes: 20 additions & 0 deletions html/includes/graphs/rserver/auth.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

if (is_numeric($id))
{
# $auth= TRUE;
$rserver = dbFetchRow("SELECT * FROM `loadbalancer_rservers` AS I, `devices` AS D WHERE I.rserver_id = ? AND I.device_id = D.device_id", array($id));

if (is_numeric($rserver['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($rserver['device_id'])))
{
$device = device_by_id_cache($rserver['device_id']);

$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("rserver-".$rserver['rserver_id'].".rrd");

$title = generate_device_link($device);
$title .= " :: Rserver :: " . htmlentities($rserver['farm_id']);
$auth = TRUE;
}
}

?>
40 changes: 40 additions & 0 deletions html/includes/graphs/rserver/curr.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

##$ds_in = "RserverCurrentConns";
##$ds_out = "RserverTotalConns";

##include("includes/graphs/generic_bytes.inc.php");

#$ds = "RserverCurrentConns";

#$colour_area = "B0C4DE";
#$colour_line = "191970";

#$colour_area_max = "FFEE99";

#$graph_max = 1;

#$unit_text = "Conns";

#include("includes/graphs/generic_simplex.inc.php");


$scale_min = 0;

include("includes/graphs/common.inc.php");
$graph_max = 1;

$ds = "RserverCurrentConns";

$colour_area = "B0C4DE";
$colour_line = "191970";

$colour_area_max = "FFEE99";


$nototal = 1;
$unit_text = "Conns";

include("includes/graphs/generic_simplex.inc.php");

?>
21 changes: 21 additions & 0 deletions html/includes/graphs/rserver/failed.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

$scale_min = 0;

include("includes/graphs/common.inc.php");
$graph_max = 1;

$ds = "RserverCurrentConns";

$colour_area = "B0C4DE";
$colour_line = "191970";

$colour_area_max = "FFEE99";


$nototal = 1;
$unit_text = "Conns";

include("includes/graphs/generic_simplex.inc.php");

?>
21 changes: 21 additions & 0 deletions html/includes/graphs/rserver/total.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

$scale_min = 0;

include("includes/graphs/common.inc.php");
$graph_max = 1;

$ds = "RserverTotalConns";

$colour_area = "B0C4DE";
$colour_line = "191970";

$colour_area_max = "FFEE99";


$nototal = 1;
$unit_text = "Conns";

include("includes/graphs/generic_simplex.inc.php");

?>
20 changes: 20 additions & 0 deletions html/includes/graphs/vserver/auth.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

if (is_numeric($id))
{
# $auth= TRUE;
$vserver = dbFetchRow("SELECT * FROM `loadbalancer_vservers` AS I, `devices` AS D WHERE I.classmap_id = ? AND I.device_id = D.device_id", array($id));

if (is_numeric($vserver['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($vserver['device_id'])))
{
$device = device_by_id_cache($vserver['device_id']);

$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("vserver-".$vserver['classmap_id'].".rrd");

$title = generate_device_link($device);
$title .= " :: Serverfarm :: " . htmlentities($vserver['classmap_id']);
$auth = TRUE;
}
}

?>
12 changes: 12 additions & 0 deletions html/includes/graphs/vserver/bits.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

#include("includes/graphs/common.inc.php");


$ds_in = "ByteCounts";
$ds_out = "ClientByteCounts";

include("includes/graphs/generic_bytes.inc.php");
#include("includes/graphs/generic_duplex.inc.php");

?>
21 changes: 21 additions & 0 deletions html/includes/graphs/vserver/conns.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

$scale_min = 0;

include("includes/graphs/common.inc.php");
$graph_max = 1;

$ds = "NumberOfConnections";

$colour_area = "B0C4DE";
$colour_line = "191970";

$colour_area_max = "FFEE99";


$nototal = 1;
$unit_text = "Conns";

include("includes/graphs/generic_simplex.inc.php");

?>
18 changes: 18 additions & 0 deletions html/includes/graphs/vserver/pkts.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$ds_in = "PacketCounts";
$ds_out = "ClientPacketCounts";

$colour_area_in = "AA66AA";
$colour_line_in = "330033";
$colour_area_out = "FFDD88";
$colour_line_out = "FF6600";

$colour_area_in_max = "cc88cc";
$colour_area_out_max = "FFefaa";

$graph_max = 1;
$unit_text = "Packets";

include("includes/graphs/generic_duplex.inc.php");
?>
6 changes: 6 additions & 0 deletions html/pages/device.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@

### $routing_tabs is used in device/routing/ to build the tabs menu. we built it here to save some queries

$device_routing_count['loadbalancer_vservers'] = dbFetchCell("SELECT COUNT(*) FROM `loadbalancer_vservers` WHERE `device_id` = ?", array($device['device_id']));
if ($device_routing_count['loadbalancer_vservers']) { $routing_tabs[] = 'loadbalancer_vservers'; }

$device_routing_count['loadbalancer_rservers'] = dbFetchCell("SELECT COUNT(*) FROM `loadbalancer_rservers` WHERE `device_id` = ?", array($device['device_id']));
if ($device_routing_count['loadbalancer_rservers']) { $routing_tabs[] = 'loadbalancer_rservers'; }

$device_routing_count['ipsec_tunnels'] = dbFetchCell("SELECT COUNT(*) FROM `ipsec_tunnels` WHERE `device_id` = ?", array($device['device_id']));
if ($device_routing_count['ipsec_tunnels']) { $routing_tabs[] = 'ipsec_tunnels'; }

Expand Down
2 changes: 2 additions & 0 deletions html/pages/device/routing.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#$type_text['overview'] = "Overview";
$type_text['ipsec_tunnels'] = "IPSEC Tunnels";
$type_text['loadbalancer_rservers'] = "Rservers";
$type_text['loadbalancer_vservers'] = "Serverfarms";
$type_text['bgp'] = "BGP";
$type_text['cef'] = "CEF";
$type_text['ospf'] = "OSPF";
Expand Down
90 changes: 90 additions & 0 deletions html/pages/device/routing/loadbalancer_rservers.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

print_optionbar_start();

echo("<span style='font-weight: bold;'>Serverfarm Rservers</span> &#187; ");

#$auth = TRUE;

$menu_options = array('basic' => 'Basic',
);

if (!$_GET['opta']) { $_GET['opta'] = "basic"; }

$sep = "";
foreach ($menu_options as $option => $text)
{
if ($_GET['optd'] == $option) { echo("<span class='pagemenu-selected'>"); }
echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/proto=loadbalancer_rservers/' . $option . '/">' . $text
. '</a>');
if ($_GET['optd'] == $option) { echo("</span>"); }
echo(" | ");
}

unset($sep);

echo(' Graphs: ');

#$graph_types = array("bits" => "Bits",
# "pkts" => "Packets",
# "errors" => "Errors");

$graph_types = array("curr" => "CurrentConns",
"failed" => "FailedConns",
"total" => "TotalConns");

foreach ($graph_types as $type => $descr)
{
echo("$type_sep");
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>');
if ($_GET['opte'] == $type) { echo("</span>"); }

$type_sep = " | ";
}

print_optionbar_end();

echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=0 width=100%>");
$i = "0";
foreach (dbFetchRows("SELECT * FROM `loadbalancer_rservers` WHERE `device_id` = ? ORDER BY `farm_id`", array($device['device_id'])) as $rserver)
{
if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }

if($rserver['StateDescr'] == "Server is now operational") { $rserver_class="green"; } else { $rserver_class="red"; }

echo("<tr bgcolor='$bg_colour'>");
#echo("<td width=320 class=list-large>" . $tunnel['local_addr'] . " &#187; " . $tunnel['peer_addr'] . "</a></td>");
echo("<td width=700 class=list-small>" . $rserver['farm_id'] . "</a></td>");
#echo("<td width=150 class=box-desc>" . $rserver['farm_id'] . "</td>");
echo("<td width=230 class=list-small><span class='".$rserver_class."'>" . $rserver['StateDescr'] . "</span></td>");
echo("</tr>");
if ($_GET['optd'] == "graphs")
{
echo('<tr class="list-bold">');
echo("<td colspan = 3>");
$graph_type = "rserver_" . $_GET['opte'];

$graph_array['height'] = "100";
$graph_array['width'] = "215";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $rserver['rserver_id'];
$graph_array['type'] = $graph_type;

include("includes/print-quadgraphs.inc.php");
#include("includes/print-interface-graphs.inc.php");

echo("
</td>
</tr>");
}

echo("</td>");
echo("</tr>");

$i++;
}

echo("</table></div>");

?>
86 changes: 86 additions & 0 deletions html/pages/device/routing/loadbalancer_vservers.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

print_optionbar_start();

echo("<span style='font-weight: bold;'>Serverfarms</span> &#187; ");

#$auth = TRUE;

$menu_options = array('basic' => 'Basic',
);

if (!$_GET['opta']) { $_GET['opta'] = "basic"; }

$sep = "";
foreach ($menu_options as $option => $text)
{
if ($_GET['optd'] == $option) { echo("<span class='pagemenu-selected'>"); }
echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/proto=loadbalancer_vservers/' . $option . '/">' . $text
. '</a>');
if ($_GET['optd'] == $option) { echo("</span>"); }
echo(" | ");
}

unset($sep);

echo(' Graphs: ');

$graph_types = array("bits" => "Bits",
"pkts" => "Packets",
"conns" => "Connections");


foreach ($graph_types as $type => $descr)
{
echo("$type_sep");
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>');
if ($_GET['opte'] == $type) { echo("</span>"); }

$type_sep = " | ";
}

print_optionbar_end();

echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=0 width=100%>");
$i = "0";
foreach (dbFetchRows("SELECT * FROM `loadbalancer_vservers` WHERE `device_id` = ? ORDER BY `classmap`", array($device['device_id'])) as $vserver)
{
if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }

if($vserver['serverstate'] == "inService") { $vserver_class="green"; } else { $vserver_class="red"; }

echo("<tr bgcolor='$bg_colour'>");
#echo("<td width=320 class=list-large>" . $tunnel['local_addr'] . " &#187; " . $tunnel['peer_addr'] . "</a></td>");
echo("<td width=700 class=list-small>" . $vserver['classmap'] . "</a></td>");
#echo("<td width=150 class=box-desc>" . $rserver['farm_id'] . "</td>");
echo("<td width=230 class=list-small><span class='".$vserver_class."'>" . $vserver['serverstate'] . "</span></td>");
echo("</tr>");
if ($_GET['optd'] == "graphs")
{
echo('<tr class="list-bold">');
echo("<td colspan = 3>");
$graph_type = "vserver_" . $_GET['opte'];

$graph_array['height'] = "100";
$graph_array['width'] = "215";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $vserver['classmap_id'];
$graph_array['type'] = $graph_type;

include("includes/print-quadgraphs.inc.php");

echo("
</td>
</tr>");
}

echo("</td>");
echo("</tr>");

$i++;
}

echo("</table></div>");

?>
Loading

0 comments on commit 6a29f36

Please sign in to comment.