mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Cisco CEF discovery script (was misnamed, and not used yet)
git-svn-id: http://www.observium.org/svn/observer/trunk@2423 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
52
includes/discovery/cisco-cef.inc.php
Executable file
52
includes/discovery/cisco-cef.inc.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
echo("Cisco CEF Switching Path: ");
|
||||
|
||||
$cefs = array();
|
||||
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingPath", $cefs);
|
||||
if ($debug) { print_r($cefs); }
|
||||
|
||||
if (is_array($cefs))
|
||||
{
|
||||
if (!is_array($entity_array))
|
||||
{
|
||||
echo("Caching OIDs: ");
|
||||
$entity_array = array();
|
||||
echo(" entPhysicalDescr");
|
||||
$entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalDescr", $entity_array, "ENTITY-MIB");
|
||||
echo(" entPhysicalName");
|
||||
$entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalName", $entity_array, "ENTITY-MIB");
|
||||
echo(" entPhysicalModelName");
|
||||
$entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalModelName", $entity_array, "ENTITY-MIB");
|
||||
}
|
||||
foreach ($cefs as $entity => $afis)
|
||||
{
|
||||
$entity_name = $entity_array[$entity]['entPhysicalName'] ." - ".$entity_array[$entity]['entPhysicalModelName'];
|
||||
echo("\n$entity $entity_name\n");
|
||||
foreach($afis as $afi => $paths)
|
||||
{
|
||||
echo(" |- $afi\n");
|
||||
foreach($paths as $path => $path_name)
|
||||
{
|
||||
echo(" | |-".$path.": ".$path_name['cefSwitchingPath']."\n");
|
||||
|
||||
|
||||
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")
|
||||
{
|
||||
$sql = "INSERT INTO `cef` (`device_id`, `entPhysicalIndex`, `afi`, `cef_index`, `cef_path`)
|
||||
VALUES ('".$device['device_id']."', '".$entity."', '".$afi."', '".$path."', '".$path_name['cefSwitchingPath']."')";
|
||||
mysql_query($sql);
|
||||
echo("+");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
## FIXME - need to delete old ones. FIXME REALLY.
|
||||
|
||||
echo("\n");
|
||||
|
||||
?>
|
Reference in New Issue
Block a user