Cisco ACE support thanks to wez_db

git-svn-id: http://www.observium.org/svn/observer/trunk@2814 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-01-12 11:09:45 +00:00
parent 7a8b14766a
commit b15ac997f8
22 changed files with 15929 additions and 3 deletions

View File

@@ -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

View File

@@ -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;
}
}
?>

View File

@@ -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");
?>

View File

@@ -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");
?>

View File

@@ -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");
?>

View File

@@ -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;
}
}
?>

View File

@@ -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");
?>

View File

@@ -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");
?>

View File

@@ -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");
?>

View File

@@ -155,6 +155,12 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
### $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'; }

View File

@@ -6,6 +6,8 @@ $link_array = array('page' => 'device',
#$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";

View File

@@ -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>");
?>

View File

@@ -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>");
?>

View File

@@ -225,6 +225,7 @@ $config['bad_if'][] = "pppoe-";
$config['bad_if_regexp'][] = "/serial[0-9]:/";
$config['bad_if_regexp'][] = "/^ng[0-9]+$/";
$config['bad_if_regexp'][] = "/^sl[0-9]/";
$config['bad_if_regexp'][] = "/^voice\ over\ ip\ peer/";
$config['processor_filter'][] = "An electronic chip that makes the computer work.";
@@ -361,9 +362,8 @@ $config['poller_modules']['cisco-remote-access-monitor'] = 1;
$config['poller_modules']['cisco-cef'] = 1;
$config['poller_modules']['cisco-mac-accounting'] = 1;
$config['poller_modules']['cipsec-tunnels'] = 1;
$config['poller_modules']['cisco-vpdn'] = 1;
$config['poller_modules']['entity-physical'] = 1;
$config['poller_modules']['cisco-ace-loadbalancer'] = 1;
$config['poller_modules']['cisco-ace-serverfarms'] = 1;
## List of discovery modules. Need to be in this array to be
## considered for execution.

View File

@@ -0,0 +1,68 @@
<?php
$rserver_array = snmpwalk_cache_oid($device, "cesServerFarmRserverTable", array(), "CISCO-ENHANCED-SLB-MIB");
$rserver_db = dbFetchRows("SELECT * FROM `loadbalancer_rservers` WHERE `device_id` = ?", array($device['device_id']));
foreach ($rserver_db as $serverfarm) { $serverfarms[$serverfarm['farm_id']] = $serverfarm;}
foreach($rserver_array as $index => $serverfarm)
{
$clean_index = preg_replace('@\d+\."(.*?)"\.\d+@', '\\1', $index);
$oids = array (
"cesServerFarmRserverTotalConns",
"cesServerFarmRserverCurrentConns",
"cesServerFarmRserverFailedConns");
$db_oids = array($clean_index => 'farm_id', "cesServerFarmRserverStateDescr" => "StateDescr");
if(!is_array( $serverfarms[$clean_index]))
{
$rserver_id = dbInsert(array('device_id' => $device['device_id'], 'farm_id' => $clean_index, 'StateDescr' => $serverfarm['cesServerFarmRserverStateDescr']), 'loadbalancer_rservers');
} else {
foreach($db_oids as $db_oid => $db_value) {
$db_update[$db_value] = $serverfarm[$db_oid];
}
$updated = dbUpdate($db_update, 'loadbalancer_rservers', '`rserver_id` = ?', $serverfarm['cesServerFarmRserverFailedConns']['farm_id']);
}
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/rserver-".$serverfarms[$clean_index]['rserver_id'].".rrd";
#echo $rrd_file."-\n";
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
foreach ($oids as $oid)
{
$oid_ds = truncate(str_replace("cesServerFarm", "", $oid), 19, '');
$rrd_create .= " DS:$oid_ds:GAUGE:600:-1:100000000";
}
$rrdupdate = "N";
foreach ($oids as $oid)
{
if (is_numeric($serverfarm[$oid]))
{
$value = $serverfarm[$oid];
} else {
$value = "0";
}
$rrdupdate .= ":$value";
}
if (isset($serverfarms[$clean_index]))
{
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
rrdtool_update($rrd_file, $rrdupdate);
}
}
unset($oids, $oid, $serverfarm);
?>

View File

@@ -0,0 +1,73 @@
<?php
$serverfarm_array = snmpwalk_cache_oid($device, "slbVServerInfoTable", array(), "CISCO-SLB-MIB");
$serverfarm_db = dbFetchRows("SELECT * FROM `loadbalancer_vservers` WHERE `device_id` = ?", array($device['device_id']));
foreach ($serverfarm_db as $vserver) { $classmaps[$vserver['classmap']] = $vserver;}
foreach($serverfarm_array as $index => $vserver)
{
$classmap = str_replace("class-map-", "", $vserver['slbVServerClassMap']);
$classmap_id = str_replace("9.", "" , $index);
$oids = array (
"slbVServerNumberOfConnections",
"slbVServerDroppedConnections",
"slbVServerClientPacketCounts",
"slbVServerClientByteCounts",
"slbVServerPacketCounts",
"slbVServerByteCounts");
$db_oids = array($classmap_id => 'classmap_id', $classmap => 'classmap', "slbVServerState" => "serverstate");
if(!is_array( $classmaps[$classmap]))
{
$classmap_in = dbInsert(array('device_id' => $device['device_id'], 'classmap_id' => $classmap_id, 'classmap' => $classmap, 'serverstate' => $vserver['slbVServerState']), 'loadbalancer_vservers');
} else {
foreach($db_oids as $db_oid => $db_value) {
$db_update[$db_value] = $vserver[$db_oid];
}
$updated = dbUpdate($db_update, 'loadbalancer_vservers', '`classmap_id` = ?', $vserver['slbVServerState']['classmap']);
}
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/vserver-".$classmap_id.".rrd";
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
foreach ($oids as $oid)
{
$oid_ds = truncate(str_replace("slbVServer", "", $oid), 19, '');
# $rrd_create .= " DS:$oid_ds:GAUGE:600:-1:100000000";
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:1000000000";
}
$rrdupdate = "N";
foreach ($oids as $oid)
{
if (is_numeric($vserver[$oid]))
{
$value = $vserver[$oid];
} else {
$value = "0";
}
$rrdupdate .= ":$value";
}
if (isset($classmaps[$classmap]))
{
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
rrdtool_update($rrd_file, $rrdupdate);
}
}
unset($oids, $oid, $vserver);
?>

View File

@@ -0,0 +1,54 @@
<?php
$poll_device['sysDescr'] = str_replace("IOS (tm)", "IOS (tm),", $poll_device['sysDescr']);
$poll_device['sysDescr'] = str_replace(") RELEASE", "), RELEASE", $poll_device['sysDescr']);
echo("\n".$poll_device['sysDescr']."\n");
list(,$features,$version) = explode(",", $poll_device['sysDescr']);
$version = str_replace(" Version ", "", $version);
list(,$features) = explode("(", $features);
list(,$features) = explode("-", $features);
$oids = "entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1";
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB:OLD-CISCO-CHASSIS-MIB");
if ($data[1]['entPhysicalContainedIn'] == "0")
{
if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != "")
{
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != "")
{
$hardware = $data[1]['entPhysicalName'];
}
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != "")
{
$hardware = $data[1]['entPhysicalModelName'];
}
}
list($version) = explode(",", $version);
# if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
# if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
# if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
# $ciscomodel = str_replace("\"","",$ciscomodel);
# if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
if($hardware == "") { $hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB"); }
#if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
if (strpos($poll_device['sysDescr'], "IOS XR")) {
list(,$version) = explode(",", $poll_device['sysDescr']);
$version = trim($version);
list(,$version) = explode(" ", $version);
list($version) = explode("\n", $version);
trim($version);
}
?>

View File

@@ -161,6 +161,19 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool";
$config['os'][$os]['over'][2]['text'] = "Memory Usage";
$config['os'][$os]['icon'] = "cisco";
$os = "acsw";
$config['os'][$os]['group'] = "ios";
$config['os'][$os]['text'] = "Cisco Application Control Software";
$config['os'][$os]['ifname'] = 1;
$config['os'][$os]['type'] = "network";
$config['os'][$os]['icon'] = "cisco";
$config['os'][$os]['over'][0]['graph'] = "device_bits";
$config['os'][$os]['over'][0]['text'] = "Device Traffic";
$config['os'][$os]['over'][1]['graph'] = "device_processor";
$config['os'][$os]['over'][1]['text'] = "CPU Usage";
$config['os'][$os]['over'][2]['graph'] = "device_mempool";
$config['os'][$os]['over'][2]['text'] = "Memory Usage";
$os = "cat1900";
$config['os'][$os]['group'] = "cat1900";
$config['os'][$os]['text'] = "Cisco Catalyst 1900";

1664
mibs/CISCO-ENHANCED-SLB-MIB Normal file

File diff suppressed because it is too large Load Diff

5552
mibs/CISCO-SLB-EXT-MIB Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

5379
mibs/CISCO-SLB-MIB Normal file

File diff suppressed because it is too large Load Diff