diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 4bec9bc8c..fa8c0a592 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -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; diff --git a/includes/discovery/cisco-cef.inc.php b/includes/discovery/cisco-cef.inc.php index 1a3c7fd00..fca69dfe4 100755 --- a/includes/discovery/cisco-cef.inc.php +++ b/includes/discovery/cisco-cef.inc.php @@ -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") diff --git a/includes/polling/cisco-cef.inc.php b/includes/polling/cisco-cef.inc.php index ce62eb065..cdf7e1389 100755 --- a/includes/polling/cisco-cef.inc.php +++ b/includes/polling/cisco-cef.inc.php @@ -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"); ?>