From 41ddcc2b4ad77a1acf92e907c0533df3e51696e5 Mon Sep 17 00:00:00 2001 From: NetworkNub Date: Mon, 17 Oct 2016 00:35:38 -0400 Subject: [PATCH 1/7] I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md. --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index a69824430f..5da5079eb0 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -140,6 +140,7 @@ LibreNMS contributors: - Layne Breitkreutz (Gorian) - Karl Shea (karlshea) - Justin Settle (jquagga) +- Eric Conroy (NetworkNub) [1]: http://observium.org/ "Observium web site" Observium was written by: From 2aae3e6dff33330343e9f8b6e27e6272037638d2 Mon Sep 17 00:00:00 2001 From: NetworkNub Date: Mon, 17 Oct 2016 00:38:47 -0400 Subject: [PATCH 2/7] add xdp exclude device filters --- doc/Extensions/Auto-Discovery.md | 21 ++++ includes/defaults.inc.php | 3 + .../discovery/discovery-protocols.inc.php | 96 ++++++++++++++++--- 3 files changed, 107 insertions(+), 13 deletions(-) diff --git a/doc/Extensions/Auto-Discovery.md b/doc/Extensions/Auto-Discovery.md index c4760b59b1..b1595f255c 100644 --- a/doc/Extensions/Auto-Discovery.md +++ b/doc/Extensions/Auto-Discovery.md @@ -67,6 +67,27 @@ Enabled by default. This includes FDP, CDP and LLDP support based on the device type. +Devices may be excluded from xdp discovery by name, description, or platform. + +```php +//Exclude devices by name +$config['autodiscovery']['xdp_exclude']['sysname_regexp'][] = '/^dev/' + +//Exclude devices by description +$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/unmanaged switch/' + +//Exclude devices by platform(Cisco only) +$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = 'WS-C3750G-12S' +``` + +These devices are excluded by default: + +```php +$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/-K9W8-/'; // Cisco Lightweight Access Point +$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^Cisco IP Phone/'; //Cisco IP Phone +$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^CIVS-IPC-/'; //Cisco IP Camera +``` + #### OSPF Enabled by default. diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 943fcb390a..be7e87928e 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -199,6 +199,9 @@ $config['icmp_check'] = true; // Autodiscovery Settings $config['autodiscovery']['xdp'] = true; +$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/-K9W8-/'; // Cisco Lightweight Access Point +$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^Cisco IP Phone/'; //Cisco IP Phone +$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^CIVS-IPC-/'; //Cisco IP Camera // Autodiscover hosts via discovery protocols $config['autodiscovery']['ospf'] = true; // Autodiscover hosts via OSPF diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 11a01b08b5..63a4587f4d 100644 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -19,7 +19,23 @@ if ($device['os'] == 'ironware' && $config['autodiscovery']['xdp'] === true) { $remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDeviceId'])); if (!$remote_device_id) { - $remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId'], $device, 'FDP', $interface); + unset($skip_discovery); + foreach ($config['autodiscovery']['xdp_exclude']['sysname_regexp'] as $filter) { + if (preg_match($filter ."i", $fdp['snFdpCacheDeviceId'])) { + $skip_discovery = 1; + d_echo("{$fdp['snFdpCacheDeviceId']} - regexp '{$filter}' matches '{$fdp['snFdpCacheDeviceId']}' - skipping device discovery \n"); + } + } + foreach ($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'] as $filter) { + if (preg_match($filter ."i", $fdp['cdpCacheVersion'])) { + $skip_discovery = 1; + d_echo("{$fdp['snFdpCacheDeviceId']} - regexp '{$filter}' matches '{$fdp['cdpCacheVersion']}' - skipping device discovery \n"); + } + } + + if (!$skip_discovery) { + $remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId'], $device, 'FDP', $interface); + } } if ($remote_device_id) { @@ -52,19 +68,41 @@ 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) { - if ($config['discovery_by_ip'] !== true) { - $remote_device_id = discover_new_device($cdp['cdpCacheDeviceId'], $device, 'CDP', $interface); - } else { - $ip_arr = explode(" ", $cdp['cdpCacheAddress']); + unset($skip_discovery); + foreach ($config['autodiscovery']['cdp_exclude']['platform_regexp'] as $filter) { + if (preg_match($filter ."i", $cdp['cdpCachePlatform'])) { + $skip_discovery = 1; + d_echo("{$cdp['cdpCacheDeviceId']} - regexp '{$filter}' matches '{$cdp['cdpCachePlatform']}' - skipping device discovery \n"); + } + } + foreach ($config['autodiscovery']['xdp_exclude']['sysname_regexp'] as $filter) { + if (preg_match($filter ."i", $cdp['cdpCacheDeviceId'])) { + $skip_discovery = 1; + d_echo("{$cdp['cdpCacheDeviceId']} - regexp '{$filter}' matches '{$cdp['cdpCacheDeviceId']}' - skipping device discovery \n"); + } + } + foreach ($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'] as $filter) { + if (preg_match($filter ."i", $cdp['cdpCacheVersion'])) { + $skip_discovery = 1; + d_echo("{$cdp['cdpCacheDeviceId']} - regexp '{$filter}' matches '{$cdp['cdpCacheVersion']}' - skipping device discovery \n"); + } + } - $a = hexdec($ip_arr[0]); - $b = hexdec($ip_arr[1]); - $c = hexdec($ip_arr[2]); - $d = hexdec($ip_arr[3]); + if (!$skip_discovery) { + if ($config['discovery_by_ip'] !== true) { + $remote_device_id = discover_new_device($cdp['cdpCacheDeviceId'], $device, 'CDP', $interface); + } else { + $ip_arr = explode(" ", $cdp['cdpCacheAddress']); - $cdp_ip = "$a.$b.$c.$d"; + $a = hexdec($ip_arr[0]); + $b = hexdec($ip_arr[1]); + $c = hexdec($ip_arr[2]); + $d = hexdec($ip_arr[3]); - $remote_device_id = discover_new_device($cdp_ip, $device, 'CDP', $interface); + $cdp_ip = "$a.$b.$c.$d"; + + $remote_device_id = discover_new_device($cdp_ip, $device, 'CDP', $interface); + } } } @@ -102,7 +140,23 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) { $remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($lldp['lldpRemSysName'], $lldp['lldpRemSysName'])); if (!$remote_device_id && is_valid_hostname($lldp['lldpRemSysName'])) { - $remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface); + unset($skip_discovery); + foreach ($config['autodiscovery']['xdp_exclude']['sysname_regexp'] as $filter) { + if (preg_match($filter ."i", $lldp['lldpRemSysName'])) { + $skip_discovery = 1; + d_echo("{$lldp['lldpRemSysName']} - regexp '{$filter}' matches '{$lldp['lldpRemSysName']}' - skipping device discovery \n"); + } + } + foreach ($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'] as $filter) { + if (preg_match($filter ."i", $lldp['lldpRemSysDesc'])) { + $skip_discovery = 1; + d_echo("{$lldp['lldpRemSysName']} - regexp '{$filter}' matches '{$lldp['lldpRemSysDesc']}' - skipping device discovery \n"); + } + } + + if (!$skip_discovery) { + $remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface); + } } if ($remote_device_id) { @@ -144,7 +198,23 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) { $remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($lldp['lldpRemSysName'], $lldp['lldpRemSysName'])); if (!$remote_device_id && is_valid_hostname($lldp['lldpRemSysName'])) { - $remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface); + unset($skip_discovery); + foreach ($config['autodiscovery']['xdp_exclude']['sysname_regexp'] as $filter) { + if (preg_match($filter ."i", $lldp['lldpRemSysName'])) { + $skip_discovery = 1; + d_echo("{$lldp['lldpRemSysName']} - regexp '{$filter}' matches '{$lldp['lldpRemSysName']}' - skipping device discovery \n"); + } + } + foreach ($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'] as $filter) { + if (preg_match($filter ."i", $lldp['lldpRemSysDesc'])) { + $skip_discovery = 1; + d_echo("{$lldp['lldpRemSysName']} - regexp '{$filter}' matches '{$lldp['lldpRemSysDesc']}' - skipping device discovery \n"); + } + } + + if (!$skip_discovery) { + $remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface); + } } // normalize MAC address if present $remote_port_mac_address = ''; From 81133cc09e4767a940fb50d95c17544a93992cff Mon Sep 17 00:00:00 2001 From: NetworkNub Date: Tue, 18 Oct 2016 09:49:24 -0400 Subject: [PATCH 3/7] update xdp filter documentation --- doc/Extensions/Auto-Discovery.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/Extensions/Auto-Discovery.md b/doc/Extensions/Auto-Discovery.md index b1595f255c..7fb73ac59d 100644 --- a/doc/Extensions/Auto-Discovery.md +++ b/doc/Extensions/Auto-Discovery.md @@ -67,17 +67,23 @@ Enabled by default. This includes FDP, CDP and LLDP support based on the device type. -Devices may be excluded from xdp discovery by name, description, or platform. +Devices may be excluded from xdp discovery by sysname and sysdesc. ```php //Exclude devices by name -$config['autodiscovery']['xdp_exclude']['sysname_regexp'][] = '/^dev/' +$config['autodiscovery']['xdp_exclude']['sysname_regexp'][] = '/host1/'; +$config['autodiscovery']['xdp_exclude']['sysname_regexp'][] = '/^dev/'; //Exclude devices by description -$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/unmanaged switch/' +$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/Vendor X/'; +$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/Vendor Y/'; +``` +Devices may be excluded from cdp discovery by platform. + +```php //Exclude devices by platform(Cisco only) -$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = 'WS-C3750G-12S' +$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/WS-C3750G/'; ``` These devices are excluded by default: From 46d2f578e7974686ac1106711bf8da04fc45cc6d Mon Sep 17 00:00:00 2001 From: laf Date: Tue, 18 Oct 2016 03:06:03 +0000 Subject: [PATCH 4/7] added central function and updated --- doc/Extensions/Auto-Discovery.md | 8 -- includes/defaults.inc.php | 3 - .../discovery/discovery-protocols.inc.php | 79 ++++++------------- includes/functions.php | 18 +++++ 4 files changed, 44 insertions(+), 64 deletions(-) diff --git a/doc/Extensions/Auto-Discovery.md b/doc/Extensions/Auto-Discovery.md index 7fb73ac59d..44ff640bd8 100644 --- a/doc/Extensions/Auto-Discovery.md +++ b/doc/Extensions/Auto-Discovery.md @@ -86,14 +86,6 @@ Devices may be excluded from cdp discovery by platform. $config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/WS-C3750G/'; ``` -These devices are excluded by default: - -```php -$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/-K9W8-/'; // Cisco Lightweight Access Point -$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^Cisco IP Phone/'; //Cisco IP Phone -$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^CIVS-IPC-/'; //Cisco IP Camera -``` - #### OSPF Enabled by default. diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index be7e87928e..943fcb390a 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -199,9 +199,6 @@ $config['icmp_check'] = true; // Autodiscovery Settings $config['autodiscovery']['xdp'] = true; -$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/-K9W8-/'; // Cisco Lightweight Access Point -$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^Cisco IP Phone/'; //Cisco IP Phone -$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^CIVS-IPC-/'; //Cisco IP Camera // Autodiscover hosts via discovery protocols $config['autodiscovery']['ospf'] = true; // Autodiscover hosts via OSPF diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 63a4587f4d..674728a764 100644 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -19,21 +19,15 @@ if ($device['os'] == 'ironware' && $config['autodiscovery']['xdp'] === true) { $remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDeviceId'])); if (!$remote_device_id) { - unset($skip_discovery); - foreach ($config['autodiscovery']['xdp_exclude']['sysname_regexp'] as $filter) { - if (preg_match($filter ."i", $fdp['snFdpCacheDeviceId'])) { - $skip_discovery = 1; - d_echo("{$fdp['snFdpCacheDeviceId']} - regexp '{$filter}' matches '{$fdp['snFdpCacheDeviceId']}' - skipping device discovery \n"); - } + $skip_discovery = false; + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysname_regexp'], $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDeviceId']); } - foreach ($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'] as $filter) { - if (preg_match($filter ."i", $fdp['cdpCacheVersion'])) { - $skip_discovery = 1; - d_echo("{$fdp['snFdpCacheDeviceId']} - regexp '{$filter}' matches '{$fdp['cdpCacheVersion']}' - skipping device discovery \n"); - } + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'], $fdp['cdpCacheVersion'], $fdp['snFdpCacheDeviceId']); } - if (!$skip_discovery) { + if ($skip_discovery === false) { $remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId'], $device, 'FDP', $interface); } } @@ -68,27 +62,18 @@ 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) { - unset($skip_discovery); - foreach ($config['autodiscovery']['cdp_exclude']['platform_regexp'] as $filter) { - if (preg_match($filter ."i", $cdp['cdpCachePlatform'])) { - $skip_discovery = 1; - d_echo("{$cdp['cdpCacheDeviceId']} - regexp '{$filter}' matches '{$cdp['cdpCachePlatform']}' - skipping device discovery \n"); - } + $skip_discovery = false; + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['cdp_exclude']['platform_regexp'], $cdp['cdpCachePlatform'], $cdp['cdpCacheDeviceId']); } - foreach ($config['autodiscovery']['xdp_exclude']['sysname_regexp'] as $filter) { - if (preg_match($filter ."i", $cdp['cdpCacheDeviceId'])) { - $skip_discovery = 1; - d_echo("{$cdp['cdpCacheDeviceId']} - regexp '{$filter}' matches '{$cdp['cdpCacheDeviceId']}' - skipping device discovery \n"); - } + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysname_regexp'], $cdp['cdpCacheDeviceId'], $cdp['cdpCacheDeviceId']); } - foreach ($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'] as $filter) { - if (preg_match($filter ."i", $cdp['cdpCacheVersion'])) { - $skip_discovery = 1; - d_echo("{$cdp['cdpCacheDeviceId']} - regexp '{$filter}' matches '{$cdp['cdpCacheVersion']}' - skipping device discovery \n"); - } + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'], $cdp['cdpCacheVersion'], $cdp['cdpCacheDeviceId']); } - if (!$skip_discovery) { + if ($skip_discovery === false) { if ($config['discovery_by_ip'] !== true) { $remote_device_id = discover_new_device($cdp['cdpCacheDeviceId'], $device, 'CDP', $interface); } else { @@ -140,21 +125,15 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) { $remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($lldp['lldpRemSysName'], $lldp['lldpRemSysName'])); if (!$remote_device_id && is_valid_hostname($lldp['lldpRemSysName'])) { - unset($skip_discovery); - foreach ($config['autodiscovery']['xdp_exclude']['sysname_regexp'] as $filter) { - if (preg_match($filter ."i", $lldp['lldpRemSysName'])) { - $skip_discovery = 1; - d_echo("{$lldp['lldpRemSysName']} - regexp '{$filter}' matches '{$lldp['lldpRemSysName']}' - skipping device discovery \n"); - } + $skip_discovery = false; + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysname_regexp'], $lldp['lldpRemSysName'], $lldp['lldpRemSysName']); } - foreach ($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'] as $filter) { - if (preg_match($filter ."i", $lldp['lldpRemSysDesc'])) { - $skip_discovery = 1; - d_echo("{$lldp['lldpRemSysName']} - regexp '{$filter}' matches '{$lldp['lldpRemSysDesc']}' - skipping device discovery \n"); - } + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'], $lldp['lldpRemSysDesc'], $lldp['lldpRemSysName']); } - if (!$skip_discovery) { + if ($skip_discovery === false) { $remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface); } } @@ -198,21 +177,15 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) { $remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($lldp['lldpRemSysName'], $lldp['lldpRemSysName'])); if (!$remote_device_id && is_valid_hostname($lldp['lldpRemSysName'])) { - unset($skip_discovery); - foreach ($config['autodiscovery']['xdp_exclude']['sysname_regexp'] as $filter) { - if (preg_match($filter ."i", $lldp['lldpRemSysName'])) { - $skip_discovery = 1; - d_echo("{$lldp['lldpRemSysName']} - regexp '{$filter}' matches '{$lldp['lldpRemSysName']}' - skipping device discovery \n"); - } + $skip_discovery = false; + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysname_regexp'], $lldp['lldpRemSysName'], $lldp['lldpRemSysName']); } - foreach ($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'] as $filter) { - if (preg_match($filter ."i", $lldp['lldpRemSysDesc'])) { - $skip_discovery = 1; - d_echo("{$lldp['lldpRemSysName']} - regexp '{$filter}' matches '{$lldp['lldpRemSysDesc']}' - skipping device discovery \n"); - } + if ($skip_discovery === false) { + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'], $lldp['lldpRemSysDesc'], $lldp['lldpRemSysName']); } - if (!$skip_discovery) { + if ($skip_discovery === true) { $remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface); } } diff --git a/includes/functions.php b/includes/functions.php index 73858ebc49..c2e85714dd 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1736,3 +1736,21 @@ function get_toner_levels($device, $raw_value, $capacity) return round($raw_value / $capacity * 100); } + +/** + * check if we should skip this device from discovery + * @param $needles + * @param $haystack + * @param $name + * @return bool + */ +function can_skip_discovery($needles, $haystack, $name) +{ + foreach ((array)$needles as $needle) { + if (preg_match($needle ."i", $haystack)) { + d_echo("{$name} - regexp '{$needle}' matches '{$haystack}' - skipping device discovery \n"); + return true; + } + } + return false; +} From 41a40bf6e624d0a4805607c445eec76456c086e1 Mon Sep 17 00:00:00 2001 From: NetworkNub Date: Thu, 20 Oct 2016 20:24:40 -0400 Subject: [PATCH 5/7] fix copy paste error --- includes/discovery/discovery-protocols.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 674728a764..8c1060881f 100644 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -24,7 +24,7 @@ if ($device['os'] == 'ironware' && $config['autodiscovery']['xdp'] === true) { $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysname_regexp'], $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDeviceId']); } if ($skip_discovery === false) { - $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'], $fdp['cdpCacheVersion'], $fdp['snFdpCacheDeviceId']); + $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'], $fdp['snFdpCacheVersion'], $fdp['snFdpCacheDeviceId']); } if ($skip_discovery === false) { From 175db1deb50c8c98a4f6829f89c953839af1db02 Mon Sep 17 00:00:00 2001 From: NetworkNub Date: Thu, 20 Oct 2016 20:36:18 -0400 Subject: [PATCH 6/7] fix lldp discovery --- includes/discovery/discovery-protocols.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 8c1060881f..6dd4d44ae0 100644 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -185,7 +185,7 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) { $skip_discovery = can_skip_discovery($config['autodiscovery']['xdp_exclude']['sysdesc_regexp'], $lldp['lldpRemSysDesc'], $lldp['lldpRemSysName']); } - if ($skip_discovery === true) { + if ($skip_discovery === false) { $remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface); } } From 6006720b7f8a91094e7fec6b4572707ce9bf98b9 Mon Sep 17 00:00:00 2001 From: laf Date: Thu, 20 Oct 2016 22:19:07 +0000 Subject: [PATCH 7/7] Re-added one default --- doc/Extensions/Auto-Discovery.md | 7 +++++++ includes/defaults.inc.php | 2 ++ 2 files changed, 9 insertions(+) diff --git a/doc/Extensions/Auto-Discovery.md b/doc/Extensions/Auto-Discovery.md index 44ff640bd8..ada1d57dd6 100644 --- a/doc/Extensions/Auto-Discovery.md +++ b/doc/Extensions/Auto-Discovery.md @@ -86,6 +86,13 @@ Devices may be excluded from cdp discovery by platform. $config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/WS-C3750G/'; ``` +These devices are excluded by default: + +```php +$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/-K9W8-/'; // Cisco Lightweight Access Point +$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^Cisco IP Phone/'; //Cisco IP Phone +``` + #### OSPF Enabled by default. diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 943fcb390a..f6af442054 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -199,6 +199,8 @@ $config['icmp_check'] = true; // Autodiscovery Settings $config['autodiscovery']['xdp'] = true; +$config['autodiscovery']['xdp_exclude']['sysdesc_regexp'][] = '/-K9W8-/'; // Cisco Lightweight Access Point +$config['autodiscovery']['cdp_exclude']['platform_regexp'][] = '/^Cisco IP Phone/'; //Cisco IP Phone // Autodiscover hosts via discovery protocols $config['autodiscovery']['ospf'] = true; // Autodiscover hosts via OSPF