tweak parsing of lists of regex in config
This commit is contained in:
@@ -198,7 +198,7 @@ sub store_interfaces {
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar grep {$port =~ m/$_/} @{setting('ignore_interfaces') || []}) {
|
if (scalar grep {$port =~ m/^$_$/} @{setting('ignore_interfaces') || []}) {
|
||||||
debug sprintf
|
debug sprintf
|
||||||
' [%s] interfaces - ignoring %s (%s) (config:ignore_interfaces)',
|
' [%s] interfaces - ignoring %s (%s) (config:ignore_interfaces)',
|
||||||
$device->ip, $entry, $port;
|
$device->ip, $entry, $port;
|
||||||
@@ -807,12 +807,14 @@ sub discover_new_neighbors {
|
|||||||
my $device = get_device($ip);
|
my $device = get_device($ip);
|
||||||
next if $device->in_storage;
|
next if $device->in_storage;
|
||||||
|
|
||||||
my $remote_type_match = setting('discover_no_type');
|
if ($remote_type) {
|
||||||
if ($remote_type and $remote_type_match
|
if (scalar grep {$remote_type =~ m/$_/}
|
||||||
and $remote_type =~ m/$remote_type_match/) {
|
@{setting('discover_no_type') || []}) {
|
||||||
debug sprintf ' queue - %s, type [%s] excluded by discover_no_type',
|
debug sprintf
|
||||||
$ip, $remote_type;
|
' queue - %s, type [%s] excluded by discover_no_type',
|
||||||
next;
|
$ip, $remote_type;
|
||||||
|
next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# could fail if queued job already exists
|
# could fail if queued job already exists
|
||||||
|
|||||||
@@ -225,10 +225,14 @@ IPv6).
|
|||||||
|
|
||||||
Value: List of Strings. Default: None.
|
Value: List of Strings. Default: None.
|
||||||
|
|
||||||
Place a regular expression pattern here to exclude the discovery of certain
|
Place regular expression patterns here to exclude the discovery of certain
|
||||||
devices based on the CDP/LLDP device type information. Good for excluding a
|
devices based on the CDP/LLDP device type information. Good for excluding a
|
||||||
whole device class like lightweight access points or IP phones that have CDP
|
whole device class like lightweight access points or IP phones that have CDP
|
||||||
but don't talk SNMP
|
but don't talk SNMP. For example:
|
||||||
|
|
||||||
|
discover_no_type:
|
||||||
|
- 'cisco\s+AIR-LAP'
|
||||||
|
- '(?i)Cisco\s+IP\s+Phone'
|
||||||
|
|
||||||
=head3 C<macsuck_all_vlans>
|
=head3 C<macsuck_all_vlans>
|
||||||
|
|
||||||
@@ -267,29 +271,28 @@ it.
|
|||||||
Value: List of Strings. Default:
|
Value: List of Strings. Default:
|
||||||
|
|
||||||
ignore_interfaces:
|
ignore_interfaces:
|
||||||
- EOBC
|
- 'EOBC'
|
||||||
- unrouted VLAN
|
- 'unrouted VLAN'
|
||||||
- StackPort
|
- 'StackPort'
|
||||||
- Control Plane Interface
|
- 'Control Plane Interface'
|
||||||
- SPAN (S|R)P Interface
|
- 'SPAN (S|R)P Interface'
|
||||||
- StackSub
|
- 'StackSub'
|
||||||
- netflow
|
- 'netflow'
|
||||||
- Vlan\d+-mpls layer
|
- 'Vlan\d+-mpls layer'
|
||||||
- BRI\S+-Bearer Channel
|
- 'BRI\S+-Bearer Channel'
|
||||||
- BRI\S+-Physical
|
- 'BRI\S+-Physical'
|
||||||
- BRI\S+-Signalling
|
- 'BRI\S+-Signalling'
|
||||||
- Embedded-Service-Engine\d+\/\d+
|
- 'Embedded-Service-Engine\d+\/\d+'
|
||||||
- Virtual-Template\d+
|
- 'Virtual-Template\d+'
|
||||||
- Virtual-Access\d+
|
- 'Virtual-Access\d+'
|
||||||
- (E|T)\d \d\/\d\/\d
|
- '(E|T)\d \d\/\d\/\d'
|
||||||
- Vlan1
|
- 'Vlan1'
|
||||||
|
|
||||||
If present, device ports whose names match fully any of the items in this list
|
If present, device ports whose names match fully any of the items in this list
|
||||||
will be ignored by the discovery process.
|
will be ignored by the discovery process.
|
||||||
|
|
||||||
Note this may have side effects - connected devices and nodes on those ports
|
Note this may have side effects - connected devices and nodes on those ports
|
||||||
will in turn also not be discovered. Also note that backslashes must be
|
will in turn also not be discovered.
|
||||||
doubled in the YAML format.
|
|
||||||
|
|
||||||
=head3 C<ignore_private_nets>
|
=head3 C<ignore_private_nets>
|
||||||
|
|
||||||
|
|||||||
@@ -87,14 +87,14 @@ ignore_interfaces:
|
|||||||
- 'SPAN (S|R)P Interface'
|
- 'SPAN (S|R)P Interface'
|
||||||
- 'StackSub'
|
- 'StackSub'
|
||||||
- 'netflow'
|
- 'netflow'
|
||||||
- 'Vlan\\d+-mpls layer'
|
- 'Vlan\d+-mpls layer'
|
||||||
- 'BRI\\S+-Bearer Channel'
|
- 'BRI\S+-Bearer Channel'
|
||||||
- 'BRI\\S+-Physical'
|
- 'BRI\S+-Physical'
|
||||||
- 'BRI\\S+-Signalling'
|
- 'BRI\S+-Signalling'
|
||||||
- 'Embedded-Service-Engine\\d+\\/\\d+'
|
- 'Embedded-Service-Engine\d+\/\d+'
|
||||||
- 'Virtual-Template\\d+'
|
- 'Virtual-Template\d+'
|
||||||
- 'Virtual-Access\\d+'
|
- 'Virtual-Access\d+'
|
||||||
- '(E|T)\\d \\d\\/\\d\\/\\d'
|
- '(E|T)\d \d\/\d\/\d'
|
||||||
- 'Vlan1'
|
- 'Vlan1'
|
||||||
|
|
||||||
workers:
|
workers:
|
||||||
|
|||||||
Reference in New Issue
Block a user