mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -8,7 +8,7 @@ $ports = snmp_walk($device, "ifDescr", "-Onsq", "IF-MIB");
|
|||||||
|
|
||||||
$ports = str_replace("\"", "", $ports);
|
$ports = str_replace("\"", "", $ports);
|
||||||
$ports = str_replace("ifDescr.", "", $ports);
|
$ports = str_replace("ifDescr.", "", $ports);
|
||||||
$ports = str_replace(" ", "||", $ports);
|
#$ports = str_replace(" ", "||", $ports);
|
||||||
|
|
||||||
$interface_ignored = 0;
|
$interface_ignored = 0;
|
||||||
$interface_added = 0;
|
$interface_added = 0;
|
||||||
@@ -16,7 +16,7 @@ $interface_added = 0;
|
|||||||
foreach (explode("\n", $ports) as $entry){
|
foreach (explode("\n", $ports) as $entry){
|
||||||
|
|
||||||
$entry = trim($entry);
|
$entry = trim($entry);
|
||||||
list($ifIndex, $ifDescr) = explode("||", $entry, 2);
|
list($ifIndex, $ifDescr) = explode(" ", $entry, 2);
|
||||||
if (!strstr($entry, "irtual")) {
|
if (!strstr($entry, "irtual")) {
|
||||||
$if = trim(strtolower($ifDescr));
|
$if = trim(strtolower($ifDescr));
|
||||||
$nullintf = 0;
|
$nullintf = 0;
|
||||||
@@ -39,7 +39,7 @@ foreach (explode("\n", $ports) as $entry){
|
|||||||
if ($debug) echo("\n $if ");
|
if ($debug) echo("\n $if ");
|
||||||
if ($nullintf == 0) {
|
if ($nullintf == 0) {
|
||||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '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
|
# Add Interface
|
||||||
echo("+");
|
echo("+");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ if($argv[1] == "--device" && $argv[2]) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$debug = 1;
|
||||||
|
|
||||||
if ($argv[2] == "--type" && $argv[3]) {
|
if ($argv[2] == "--type" && $argv[3]) {
|
||||||
$discovery_type = $argv[3];
|
$discovery_type = $argv[3];
|
||||||
} elseif ($argv[3] == "--type" && $argv[4]) {
|
} elseif ($argv[3] == "--type" && $argv[4]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user