fix ASA port discovery (fuck you, cisco, just fuck you)

git-svn-id: http://www.observium.org/svn/observer/trunk@1844 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-03-15 13:49:11 +00:00
parent 6cc1bb0c29
commit 96cedc5ed9
2 changed files with 5 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ $ports = snmp_walk($device, "ifDescr", "-Onsq", "IF-MIB");
$ports = str_replace("\"", "", $ports);
$ports = str_replace("ifDescr.", "", $ports);
$ports = str_replace(" ", "||", $ports);
#$ports = str_replace(" ", "||", $ports);
$interface_ignored = 0;
$interface_added = 0;
@@ -16,7 +16,7 @@ $interface_added = 0;
foreach (explode("\n", $ports) as $entry){
$entry = trim($entry);
list($ifIndex, $ifDescr) = explode("||", $entry, 2);
list($ifIndex, $ifDescr) = explode(" ", $entry, 2);
if (!strstr($entry, "irtual")) {
$if = trim(strtolower($ifDescr));
$nullintf = 0;
@@ -39,7 +39,7 @@ foreach (explode("\n", $ports) as $entry){
if ($debug) echo("\n $if ");
if ($nullintf == 0) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') {
mysql_query("INSERT INTO `ports` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','$ifDescr')");
mysql_query("INSERT INTO `ports` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','".mres($ifDescr)."')");
# Add Interface
echo("+");
} else {

View File

@@ -31,6 +31,8 @@ if($argv[1] == "--device" && $argv[2]) {
exit;
}
$debug = 1;
if ($argv[2] == "--type" && $argv[3]) {
$discovery_type = $argv[3];
} elseif ($argv[3] == "--type" && $argv[4]) {