From 6f8af7ed9df475dbe9362fcee4b130d7190a2981 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Wed, 12 Jul 2023 21:42:24 +0100 Subject: [PATCH] #1059 add NETDISCO_SNMP_BULKWALK_OFF environment to disable bulkwalk --- lib/App/Netdisco/Configuration.pm | 4 ++++ lib/App/Netdisco/Transport/SNMP.pm | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Configuration.pm b/lib/App/Netdisco/Configuration.pm index 278864cd..64f297b0 100644 --- a/lib/App/Netdisco/Configuration.pm +++ b/lib/App/Netdisco/Configuration.pm @@ -172,6 +172,10 @@ if ($ENV{NETDISCO_DOMAIN}) { } } +# override SNMP bulkwalk from environment +config->{'bulkwalk_off'} = true + if (exists $ENV{NETDISCO_SNMP_BULKWALK_OFF} and $ENV{NETDISCO_SNMP_BULKWALK_OFF}); + # check user's port_control_reasons config->{'port_control_reasons'} = diff --git a/lib/App/Netdisco/Transport/SNMP.pm b/lib/App/Netdisco/Transport/SNMP.pm index 20217883..ae14cdf7 100644 --- a/lib/App/Netdisco/Transport/SNMP.pm +++ b/lib/App/Netdisco/Transport/SNMP.pm @@ -185,7 +185,8 @@ sub _snmp_connect_generic { $snmp_args{ $k } = setting('net_snmp_options')->{ $k }; } - if (scalar keys %{ setting('net_snmp_options') }) { + if (scalar keys %{ setting('net_snmp_options') } + or not $snmp_args{BulkWalk}) { foreach my $k (sort keys %snmp_args) { next if $k eq 'MibDirs'; debug sprintf 'snmp transport conf: %s => %s', $k, $snmp_args{ $k };