mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
new funky discovery stuff (autodiscovery works now for discovery protocols)
git-svn-id: http://www.observium.org/svn/observer/trunk@2460 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -21,7 +21,12 @@ if ($device['os'] == "ironware")
|
||||
{
|
||||
$fdp = $fdp_if_array[$entry_key];
|
||||
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$fdp['snFdpCacheDeviceId']."' OR `hostname`='".$fdp['snFdpCacheDeviceId']."'"), 0);
|
||||
|
||||
|
||||
if(!$remote_device_id)
|
||||
{
|
||||
$remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId']);
|
||||
}
|
||||
|
||||
if ($remote_device_id)
|
||||
{
|
||||
$if = $fdp['snFdpCacheDevicePort'];
|
||||
@@ -49,6 +54,12 @@ if ($cdp_array)
|
||||
$cdp = $cdp_if_array[$entry_key];
|
||||
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$cdp['cdpCacheDeviceId']."' OR `hostname`='".$cdp['cdpCacheDeviceId']."'"), 0);
|
||||
|
||||
if(!$remote_device_id)
|
||||
{
|
||||
$remote_device_id = discover_new_device($cdp['cdpCacheDeviceId']);
|
||||
}
|
||||
|
||||
|
||||
if ($remote_device_id)
|
||||
{
|
||||
$if = $cdp['cdpCacheDevicePort'];
|
||||
@@ -89,13 +100,20 @@ 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)
|
||||
{
|
||||
$remote_device_id = discover_new_device($lldp['lldpRemSysName']);
|
||||
}
|
||||
|
||||
if ($remote_device_id)
|
||||
{
|
||||
$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"; }
|
||||
|
||||
} 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']);
|
||||
|
||||
Reference in New Issue
Block a user