snmp_remoteport setting to override port 161 for SNMP targets

This commit is contained in:
Oliver Gorwits
2018-02-01 17:54:50 +00:00
parent 1f1af381fb
commit 340773ecd1
3 changed files with 8 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
[NEW FEATURES]
* #332 Autodiscovery via BGP and OSPF peers
* snmp_remoteport setting to override port 161 for SNMP targets
[ENHANCEMENTS]

View File

@@ -12,6 +12,7 @@ use Try::Tiny;
use Module::Load ();
use Path::Class 'dir';
use NetAddr::IP::Lite ':lower';
use List::Util qw/pairkeys pairfirst/;
use base 'Dancer::Object::Singleton';
@@ -131,6 +132,11 @@ sub _snmp_connect_generic {
DebugSNMP => ($ENV{SNMP_TRACE} || 0),
);
# an override for RemotePort
($snmp_args{RemotePort}) =
(pairkeys pairfirst { check_acl_no($device, $b) }
%{setting('snmp_remoteport') || {}}) || 161;
# an override for bulkwalk
$snmp_args{BulkWalk} = 0 if check_acl_no($device, 'bulkwalk_no');

View File

@@ -197,6 +197,7 @@ nonincreasing: false
snmpver: 3
snmptimeout: 3000000
snmpretries: 2
snmp_remoteport: {}
devices_no: []
devices_only: []
timeout: 600