ignore notpresent interfaces, with type filtering config item (set to [] to not filter). work done by postilion/nic bernstein, filter by me. also includes trailing space fix by nic. (#464)

This commit is contained in:
nick n
2018-12-28 17:08:40 +01:00
committed by Oliver Gorwits
parent 86c38c9466
commit 8aed736925
2 changed files with 12 additions and 1 deletions

View File

@@ -181,6 +181,13 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
next;
}
# Skip interfaces which are 'notPresent' and match the notpresent type filter
if (defined $i_up->{$entry} and defined $i_type->{$entry} and $i_up->{$entry} eq 'notPresent' and (scalar grep {$i_type->{$entry} =~ m/^$_$/} @{setting('ignore_notpresent_types') || []}) ) {
debug sprintf ' [%s] interfaces - ignoring %s (%s) (%s) (config:ignore_notpresent_types)',
$device->ip, $entry, $port, $i_up->{$entry};
next;
}
my $lc = $i_lastchange->{$entry} || 0;
if (not $dev_uptime_wrapped and $lc > $dev_uptime) {
info sprintf ' [%s] interfaces - device uptime wrapped (%s) - correcting',
@@ -263,7 +270,7 @@ sub _get_vrf_list {
if ($vrf =~ /^\S+$/) {
my $ctx_name = pack("C*",split(/\./,$idx));
$ctx_name =~ s/.*[^[:print:]]+//;
debug sprintf(' [%s] Discover VRF %s with SNMP Context %s', $device->ip, $vrf, $ctx_name);
debug sprintf(' [%s] Discover VRF %s with SNMP Context %s', $device->ip, $vrf, $ctx_name);
push (@ok_vrfs, $ctx_name);
}
}