fix lldp discovery code, small fix, addhost fix

git-svn-id: http://www.observium.org/svn/observer/trunk@1547 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-07-30 15:04:44 +00:00
parent be799247e3
commit ee3fbf8a5f
4 changed files with 16 additions and 12 deletions
+2
View File
@@ -73,6 +73,7 @@ if ($device['os'] == "mgeups")
list($unused,$numPhase) = explode(' ',$oids);
for($i = 1; $i <= $numPhase;$i++)
{
unset($current);
$current_oid = ".1.3.6.1.4.1.705.1.7.2.1.5.$i";
$descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
$current = snmp_get($device, $current_oid, "-Oqv");
@@ -97,6 +98,7 @@ if ($device['os'] == "mgeups")
list($unused,$numPhase) = explode(' ',$oids);
for($i = 1; $i <= $numPhase;$i++)
{
unset($current);
$current_oid = ".1.3.6.1.4.1.705.1.6.2.1.6.$i";
$descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
$current = snmp_get($device, $current_oid, "-Oqv");
@@ -84,8 +84,8 @@ if($lldp_array) {
$lldp = $lldp_instance[$entry_instance];
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$lldp['lldpRemSysName']."' OR `hostname`='".$lldp['lldpRemSysName']."'"), 0);
if($remote_device_id) {
$if = $lldp['lldpRemPortDesc'];
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0);
$if = $lldp['lldpRemPortDesc']; $id = $lldp['lldpRemPortId'];
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if' OR `ifDescr`= '$id' OR `ifName`='$id') AND `device_id` = '".$remote_device_id."'"),0);
} else { $remote_interface_id = "0"; }
if(is_numeric($interface['interface_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId'])) {
discover_link($interface['interface_id'], 'lldp', $remote_interface_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], NULL, $lldp['lldpRemSysDesc']);