delete old cef entries, disable cef-discovery (it's in poller, duh!)

git-svn-id: http://www.observium.org/svn/observer/trunk@2740 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-11-28 11:24:32 +00:00
parent a5e0de9c09
commit 479b932467
3 changed files with 23 additions and 2 deletions

View File

@ -385,7 +385,7 @@ $config['discovery_modules']['cisco-vlans'] = 1;
$config['discovery_modules']['cisco-mac-accounting'] = 1;
$config['discovery_modules']['cisco-pw'] = 1;
$config['discovery_modules']['cisco-vrf'] = 1;
$config['discovery_modules']['cisco-cef'] = 1;
#$config['discovery_modules']['cisco-cef'] = 1;
$config['discovery_modules']['vmware-vminfo'] = 1;
$config['discovery_modules']['libvirt-vminfo'] = 1;
$config['discovery_modules']['toner'] = 1;

View File

@ -29,6 +29,7 @@ if (is_array($cefs))
foreach ($paths as $path => $path_name)
{
echo(" | |-".$path.": ".$path_name['cefSwitchingPath']."\n");
$cef_exists[$device['device_id']][$entity][$afi][$path] = 1;
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `cef` WHERE `device_id` = '".$device['device_id']."' AND `entPhysicalIndex` = '".$entity."'
AND `afi` = '".$afi."' AND `cef_index` = '".$path."'"),0) != "1")

View File

@ -6,6 +6,14 @@ $cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs);
$polled = time();
$cefs_query = dbFetchRows("SELECT * FROM `cef_switching` WHERE `device_id` = ?", array($device['device_id']));
foreach ($cefs_query as $ceftmp)
{
$cef_id = $device['device_id']."-".$ceftmp['entPhysicalIndex']."-".$ceftmp['afi']."-".$ceftmp['cef_index'];
$cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
}
if ($debug) { print_r($cefs); }
if (is_array($cefs))
@ -32,11 +40,15 @@ if (is_array($cefs))
{
echo(" | |-".$path.": ".$cef_stat['cefSwitchingPath']);
if (dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1")
$cef_id = $device['device_id']."-".$entity."-".$afi."-".$path;
# if (dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1")
if(!isset($cefs_db[$cef_id]))
{
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_index' => $path, 'cef_path' => $cef_stat['cefSwitchingPath']), 'cef_switching');
echo("+");
}
unset($cefs_db[$cef_id]);
$cef_entry = dbFetchRow("SELECT * FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path));
@ -84,6 +96,14 @@ if (is_array($cefs))
## FIXME - need to delete old ones. FIXME REALLY.
print_r($cefs_db);
foreach($cefs_db as $cef_switching_id)
{
dbDelete("cef_switching", "`cef_switching_id` = ?", array($cef_switching_id));
echo("-");
}
echo("\n");
?>