From daa8aa71f3ad9ec6040e4932a93b1b84e381a2ea Mon Sep 17 00:00:00 2001 From: Kauppine Date: Sun, 28 Jun 2020 00:52:51 +0300 Subject: [PATCH] Fixed SNMPv3 encryption and authentication --- plugins/inputs/snmp/snmp.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/inputs/snmp/snmp.go b/plugins/inputs/snmp/snmp.go index 57f29bfb02bab..779f5afc726e8 100644 --- a/plugins/inputs/snmp/snmp.go +++ b/plugins/inputs/snmp/snmp.go @@ -664,13 +664,12 @@ func (s *Snmp) getConnection(idx int) (snmpConnection, error) { } gs.MaxRepetitions = s.MaxRepetitions - if s.Version == 3 { - gs.ContextName = s.ContextName + gs.GoSNMP.ContextName = s.ContextName sp := &gosnmp.UsmSecurityParameters{} - gs.SecurityParameters = sp - gs.SecurityModel = gosnmp.UserSecurityModel + gs.GoSNMP.SecurityParameters = sp + gs.GoSNMP.SecurityModel = gosnmp.UserSecurityModel switch strings.ToLower(s.SecLevel) { case "noauthnopriv", "":