add infrastructure to collect status of cisco catalyst 6k crossbar and new state table for entity-mib

git-svn-id: http://www.observium.org/svn/observer/trunk@2723 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-11-14 18:28:00 +00:00
parent 69e0b770cc
commit 45c6d95501
13 changed files with 2875 additions and 27 deletions

View File

@@ -1194,3 +1194,6 @@ CREATE TABLE IF NOT EXISTS `bill_history` (
PRIMARY KEY (`id`),
KEY `bill_id` (`bill_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `entPhysical_state` ( `device_id` int(11) NOT NULL, `entPhysicalIndex` varchar(64) NOT NULL, `subindex` varchar(64) DEFAULT NULL, `group` varchar(64) NOT NULL, `key` varchar(64) NOT NULL, `value` varchar(255) NOT NULL, KEY `device_id_index` (`device_id`,`entPhysicalIndex`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;

View File

@@ -21,3 +21,4 @@ ALTER TABLE `bills` ADD `rate_average` int(11) NOT NULL;
ALTER TABLE `bills` ADD `bill_last_calc` datetime NOT NULL;
CREATE TABLE IF NOT EXISTS `bill_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bill_id` int(11) NOT NULL, `bill_datefrom` datetime NOT NULL, `bill_dateto` datetime NOT NULL, `bill_type` text NOT NULL, `bill_allowed` int(11) NOT NULL, `bill_used` int(11) NOT NULL, `bill_overuse` int(11) NOT NULL, `bill_percent` decimal(5,2) NOT NULL, `rate_95th_in` int(11) NOT NULL, `rate_95th_out` int(11) NOT NULL, `rate_95th` int(11) NOT NULL, `dir_95th` varchar(3) NOT NULL, `rate_average` int(11) NOT NULL, `rate_average_in` int(11) NOT NULL, `rate_average_out` int(11) NOT NULL, `traf_in` int(11) NOT NULL, `traf_out` int(11) NOT NULL, `traf_total` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `bill_id` (`bill_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `sensors` CHANGE `sensor_oid` `sensor_oid` VARCHAR( 255 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
CREATE TABLE IF NOT EXISTS `entPhysical_state` ( `device_id` int(11) NOT NULL, `entPhysicalIndex` varchar(64) NOT NULL, `subindex` varchar(64) DEFAULT NULL, `group` varchar(64) NOT NULL, `key` varchar(64) NOT NULL, `value` varchar(255) NOT NULL, KEY `device_id_index` (`device_id`,`entPhysicalIndex`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;

View File

@@ -6,7 +6,7 @@
echo("<table border=0 cellspacing=0 cellpadding=5 class=devicetable width=100%>
<tr style=\"font-weight: bold; \">
<td width=\"7\"></td>
<td width=\"220\">Period</td>
<td width=\"300\">Period</td>
<td>Type</td>
<td>Allowed</td>
<td>Inbound</td>
@@ -54,7 +54,7 @@
echo("
<tr style=\"background: $row_colour;\">
<td></td>
<td><span style=\"font-weight: bold;\" class=\"interface\">".strftime("%Y", strtotime($datefrom))." to ".strftime("%Y", strtotime($dateto))."</span></td>
<td><span style=\"font-weight: bold;\" class=\"interface\">".strftime("%Y-%m-%d", strtotime($datefrom))." -> ".strftime("%Y-%m-%d", strtotime($dateto))."</span></td>
<td>$type</td>
<td>$allowed</td>
<td>$in</td>

View File

@@ -22,6 +22,10 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
$device = device_by_id_cache($vars['device']);
$attribs = get_dev_attribs($device['device_id']);
$entity_state = get_dev_entity_state($device['device_id']);
# print_r($entity_state);
$pagetitle[] = $device['hostname'];
if ($config['os'][$device['os']]['group']) { $device['os_group'] = $config['os'][$device['os']]['group']; }

View File

@@ -78,6 +78,7 @@ echo("<td style='width: 50%; vertical-align: top;'>");
include("overview/processors.inc.php");
include("overview/mempools.inc.php");
include("overview/storage.inc.php");
if(is_array($entity_state['group']['c6kxbar'])) { include("overview/c6kxbar.inc.php"); }
include("overview/sensors/temperatures.inc.php");
include("overview/sensors/humidity.inc.php");
include("overview/sensors/fanspeeds.inc.php");

View File

@@ -0,0 +1,58 @@
<?php
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead>");
echo('<a class="sectionhead" href="device/device='.$device['device_id'].'/tab=health/metric=mempool/">');
echo("<img align='absmiddle' src='images/16/arrow_switch.png'> Catalyst 6k Crossbar</a></p>");
echo("<table width=100% cellspacing=0 cellpadding=5>");
$c6kxbar_rows = '0';
foreach($entity_state['group']['c6kxbar'] as $index => $entry)
{
if (is_integer($c6kxbar_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$entity = dbFetchRow("SELECT * FROM entPhysical WHERE device_id = ? AND entPhysicalIndex = ?", array($device['device_id'], $index));
echo("<tr bgcolor=$row_colour>
<td colspan=2 width=200><strong>".$entity['entPhysicalName']."</strong></td>
<td colspan=4>".$entry['']['cc6kxbarModuleModeSwitchingMode']."</td>
</tr>");
foreach($entity_state['group']['c6kxbar'][$index] as $subindex => $fabric)
{
if(is_numeric($subindex)) {
if($fabric['cc6kxbarModuleChannelFabStatus'] == "ok")
{
$fabric['mode_class'] = "green";
} else {
$fabric['mode_class'] = "red";
}
$percent_in = $fabric['cc6kxbarStatisticsInUtil'];
$background_in = get_percentage_colours($percent_in);
$percent_out = $fabric['cc6kxbarStatisticsOutUtil'];
$background_out = get_percentage_colours($percent_out);
echo("<tr bgcolor=$row_colour>
<td width=10></td>
<td width=200><strong>Fabric ".$subindex."</strong></td>
<td><span style='font-weight: bold;' class=".$fabric['mode_class'].">".$fabric['cc6kxbarModuleChannelFabStatus']."</span></td>
<td>".formatRates($fabric['cc6kxbarModuleChannelSpeed']*1000000)."</td>
<td>".print_percentage_bar (125, 20, $percent_in, "Ingress", "ffffff", $background['left'], $percent_in . "%", "ffffff", $background['right'])."</td>
<td>".print_percentage_bar (125, 20, $percent_out, "Egress", "ffffff", $background['left'], $percent_out . "%", "ffffff", $background['right'])."</td>
</tr>");
}
}
$c6kxbar_rows++;
}
echo("</table>");
echo("</div>");
?>

View File

@@ -394,6 +394,17 @@ function get_dev_attribs($device)
return $attribs;
}
function get_dev_entity_state($device)
{
$state = array();
foreach (dbFetchRows("SELECT * FROM entPhysical_state WHERE `device_id` = ?", array($device)) as $entity)
{
$state['group'][$entity['group']][$entity['entPhysicalIndex']][$entity['subindex']][$entity['key']] = $entity['value'];
$state['index'][$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] = $entity['value'];
}
return $state;
}
function get_dev_attrib($device, $attrib_type)
{
if ($row = dbFetchRow("SELECT attrib_value FROM devices_attribs WHERE `device_id` = ? AND `attrib_type` = ?", array($device['device_id'], $attrib_type)))

View File

@@ -359,6 +359,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']['entity-physical'] = 1;
## List of discovery modules. Need to be in this array to be
## considered for execution.

View File

@@ -17,7 +17,7 @@ if($device['os'] == "ios")
foreach($entry as $key => $value)
{
$subindex = NULL;
$entPhysical_attribs[$index][$subindex][$group][$key] = $value;
$entPhysical_state[$index][$subindex][$group][$key] = $value;
}
}
@@ -27,7 +27,7 @@ if($device['os'] == "ios")
$group = 'c6kxbar';
foreach($entry as $key => $value)
{
$entPhysical_attribs[$index][$subindex][$group][$key] = $value;
$entPhysical_state[$index][$subindex][$group][$key] = $value;
}
// FIXME -- Generate RRD files
@@ -35,31 +35,31 @@ if($device['os'] == "ios")
}
print_r($entPhysical_attribs);
#print_r($entPhysical_state);
}
// Set Entity Attribs
foreach (dbFetch("SELECT * FROM `entPhysical_attribs` WHERE `device_id` = ?", array($device['device_id'])) as $entity)
// Set Entity state
foreach (dbFetch("SELECT * FROM `entPhysical_state` WHERE `device_id` = ?", array($device['device_id'])) as $entity)
{
if (!isset($entPhysical_attribs[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']]))
if (!isset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']]))
{
dbDelete('entPhysical_attribs', "`device_id` = ? AND `entPhysicalIndex` = ? AND `subindex` = ? AND `group` = ? AND `key` = ?",
dbDelete('entPhysical_state', "`device_id` = ? AND `entPhysicalIndex` = ? AND `subindex` = ? AND `group` = ? AND `key` = ?",
array($device['device_id'], $entity['entPhysicalIndex'], $entity['subindex'], $entity['group'], $entity['key']));
} else {
if($entPhysical_attribs[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] != $entity['value'])
if($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] != $entity['value'])
{
echo("no match!");
}
unset($entPhysical_attribs[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']]);
unset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']]);
}
}
// End Set Entity Attrivs
// Delete Entity Attribs
foreach ($entPhysical_attribs as $epi => $entity)
// Delete Entity state
foreach ($entPhysical_state as $epi => $entity)
{
foreach($entity as $subindex => $si)
{
@@ -67,11 +67,11 @@ foreach ($entPhysical_attribs as $epi => $entity)
{
foreach($ti as $key => $value)
{
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $epi, 'subindex' => $subindex, 'group' => $group, 'key' => $key, 'value' => $value), 'entPhysical_attribs');
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $epi, 'subindex' => $subindex, 'group' => $group, 'key' => $key, 'value' => $value), 'entPhysical_state');
}
}
}
}
// End Delete Entity Attribs
// End Delete Entity state
?>

View File

@@ -301,13 +301,6 @@ foreach ($ports as $port)
$if_rrd_update = "$polled:$ifInOctets:$ifOutOctets:$ifInErrors:$ifOutErrors:$ifInUcastPkts:$ifOutUcastPkts:$ifInNUcastPkts:$ifOutNUcastPkts:$ifInDiscards:$ifOutDiscards:$ifInUnknownProtos";
$if_rrd_update .= ":$ifInBroadcastPkts:$ifOutBroadcastPkts:$ifInMulticastPkts:$ifOutMulticastPkts";
$ret = rrdtool_update("$rrdfile", $if_rrd_update);
# if ($config['enable_ports_Xbcmc'] && $config['os'][$device['os']]['ifXmcbc']) {
# if (!is_file($ifx_rrd)) { shell_exec($ifx_rrd_cmd); }
# $ifx_rrd_update = "$polled:$ifHCInBroadcastPkts:$ifHCOutBroadcastPkts:$ifHCInMulticastPkts:$ifHCOutMulticastPkts";
# $ret = rrdtool_update($ifx_rrd, $ifx_rrd_update);
# }
/// End Update IF-MIB
/// Update PAgP
@@ -377,7 +370,6 @@ foreach ($ports as $port)
/// Clear Per-Port Variables Here
unset($this_port);
}
/// Clear Variables Here

View File

@@ -519,7 +519,6 @@ $config['os'][$os]['over'][0]['text'] = "Traffic";
#$config['os'][$os]['over'][2]['graph'] = "device_mempool";
#$config['os'][$os]['over'][2]['text'] = "Memory Usage";
$os = "procurve";
$config['os'][$os]['text'] = "HP ProCurve";
$config['os'][$os]['type'] = "network";

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,9 @@ include("includes/functions.php");
$entry = explode(",", $argv[1]);
print_r($entry);
logfile($argv[1]);
#print_r($entry);
$device = @dbFetchRow("SELECT * FROM devices WHERE `hostname` = ?", array($entry['0']));
@@ -24,6 +26,6 @@ if (!$device['device_id'])
if (!$device['device_id']) { exit; } else { }
$file = $config['install_dir'] . "/includes/snmptrap/".$entry['1'].".inc.php";
if (is_file($file)) { include("$file"); } else { echo("unknown trap ($file)"); exit; }
if (is_file($file)) { include("$file"); } else { echo("unknown trap ($file)"); }
?>