mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #3561 from geordish/issue-2715
Enable discovery of CDP neighbour by IP address
This commit is contained in:
@@ -55,7 +55,21 @@ if ($config['autodiscovery']['xdp'] === true) {
|
||||
$remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($cdp['cdpCacheDeviceId'], $cdp['cdpCacheDeviceId']));
|
||||
|
||||
if (!$remote_device_id) {
|
||||
$remote_device_id = discover_new_device($cdp['cdpCacheDeviceId'], $device, 'CDP', $interface);
|
||||
if($config['discovery_by_ip'] !== true) {
|
||||
$remote_device_id = discover_new_device($cdp['cdpCacheDeviceId'], $device, 'CDP', $interface);
|
||||
}
|
||||
else {
|
||||
$ip_arr = explode(" ", $cdp['cdpCacheAddress']);
|
||||
|
||||
$a = hexdec($ip_arr[0]);
|
||||
$b = hexdec($ip_arr[1]);
|
||||
$c = hexdec($ip_arr[2]);
|
||||
$d = hexdec($ip_arr[3]);
|
||||
|
||||
$cdp_ip = "$a.$b.$c.$d";
|
||||
|
||||
$remote_device_id = discover_new_device($cdp_ip, $device, 'CDP', $interface);
|
||||
}
|
||||
}
|
||||
|
||||
if ($remote_device_id) {
|
||||
|
Reference in New Issue
Block a user