From 61d0ee5664da67fd76daee75668ad03cdee4057e Mon Sep 17 00:00:00 2001 From: Dane Strandboge <136023093+DStrand1@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:31:54 -0600 Subject: [PATCH 1/4] fix(inputs.snmp_trap): Only log timeout deprecation if set --- plugins/inputs/snmp_trap/snmp_trap.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/snmp_trap/snmp_trap.go b/plugins/inputs/snmp_trap/snmp_trap.go index c0890a3f4ed46..4e667ff742e79 100644 --- a/plugins/inputs/snmp_trap/snmp_trap.go +++ b/plugins/inputs/snmp_trap/snmp_trap.go @@ -84,7 +84,6 @@ func init() { return &SnmpTrap{ timeFunc: time.Now, ServiceAddress: "udp://:162", - Timeout: defaultTimeout, Path: []string{"/usr/share/snmp/mibs"}, Version: "2c", } @@ -104,6 +103,9 @@ func (s *SnmpTrap) Init() error { return err } case "netsnmp": + if s.Timeout == 0 { + s.Timeout = defaultTimeout + } s.transl = newNetsnmpTranslator(s.Timeout) default: return errors.New("invalid translator value") From 89fb5d91c142c7853ff834a46905a0e952832207 Mon Sep 17 00:00:00 2001 From: Dane Strandboge <136023093+DStrand1@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:36:25 -0600 Subject: [PATCH 2/4] remove deprecation --- plugins/inputs/snmp_trap/snmp_trap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/snmp_trap/snmp_trap.go b/plugins/inputs/snmp_trap/snmp_trap.go index 4e667ff742e79..05ba470db3c24 100644 --- a/plugins/inputs/snmp_trap/snmp_trap.go +++ b/plugins/inputs/snmp_trap/snmp_trap.go @@ -43,7 +43,7 @@ func (l wrapLog) Print(args ...interface{}) { type SnmpTrap struct { ServiceAddress string `toml:"service_address"` - Timeout config.Duration `toml:"timeout" deprecated:"1.20.0;1.35.0;unused option"` + Timeout config.Duration `toml:"timeout"` Version string `toml:"version"` Translator string `toml:"-"` Path []string `toml:"path"` From d1141c55db0d0056dca078afdd84d02a05de6777 Mon Sep 17 00:00:00 2001 From: Dane Strandboge <136023093+DStrand1@users.noreply.github.com> Date: Mon, 18 Nov 2024 08:52:01 -0600 Subject: [PATCH 3/4] update sample.conf and readme --- plugins/inputs/snmp_trap/README.md | 2 +- plugins/inputs/snmp_trap/sample.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/snmp_trap/README.md b/plugins/inputs/snmp_trap/README.md index 498efe49ff369..dbb10c8322fe3 100644 --- a/plugins/inputs/snmp_trap/README.md +++ b/plugins/inputs/snmp_trap/README.md @@ -62,8 +62,8 @@ details. ## To add paths when translating with netsnmp, use the MIBDIRS environment variable # path = ["/usr/share/snmp/mibs"] ## - ## Deprecated in 1.20.0; no longer running snmptranslate ## Timeout running snmptranslate command + ## Used by the netsnmp translator # timeout = "5s" ## Snmp version; one of "1", "2c" or "3". # version = "2c" diff --git a/plugins/inputs/snmp_trap/sample.conf b/plugins/inputs/snmp_trap/sample.conf index 62b891f73f113..0f84e6c95abc5 100644 --- a/plugins/inputs/snmp_trap/sample.conf +++ b/plugins/inputs/snmp_trap/sample.conf @@ -14,8 +14,8 @@ ## To add paths when translating with netsnmp, use the MIBDIRS environment variable # path = ["/usr/share/snmp/mibs"] ## - ## Deprecated in 1.20.0; no longer running snmptranslate ## Timeout running snmptranslate command + ## Used by the netsnmp translator # timeout = "5s" ## Snmp version; one of "1", "2c" or "3". # version = "2c" From 4cdcbf3a49f97b0c5e45a98265397d97115937f5 Mon Sep 17 00:00:00 2001 From: Dane Strandboge <136023093+DStrand1@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:53:16 -0600 Subject: [PATCH 4/4] address reviews --- plugins/inputs/snmp_trap/README.md | 2 +- plugins/inputs/snmp_trap/sample.conf | 2 +- plugins/inputs/snmp_trap/snmp_trap.go | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/inputs/snmp_trap/README.md b/plugins/inputs/snmp_trap/README.md index dbb10c8322fe3..f9d19576ac62c 100644 --- a/plugins/inputs/snmp_trap/README.md +++ b/plugins/inputs/snmp_trap/README.md @@ -63,7 +63,7 @@ details. # path = ["/usr/share/snmp/mibs"] ## ## Timeout running snmptranslate command - ## Used by the netsnmp translator + ## Used by the netsnmp translator only # timeout = "5s" ## Snmp version; one of "1", "2c" or "3". # version = "2c" diff --git a/plugins/inputs/snmp_trap/sample.conf b/plugins/inputs/snmp_trap/sample.conf index 0f84e6c95abc5..3ab073c8876f6 100644 --- a/plugins/inputs/snmp_trap/sample.conf +++ b/plugins/inputs/snmp_trap/sample.conf @@ -15,7 +15,7 @@ # path = ["/usr/share/snmp/mibs"] ## ## Timeout running snmptranslate command - ## Used by the netsnmp translator + ## Used by the netsnmp translator only # timeout = "5s" ## Snmp version; one of "1", "2c" or "3". # version = "2c" diff --git a/plugins/inputs/snmp_trap/snmp_trap.go b/plugins/inputs/snmp_trap/snmp_trap.go index 05ba470db3c24..6bebba984ec5b 100644 --- a/plugins/inputs/snmp_trap/snmp_trap.go +++ b/plugins/inputs/snmp_trap/snmp_trap.go @@ -84,6 +84,7 @@ func init() { return &SnmpTrap{ timeFunc: time.Now, ServiceAddress: "udp://:162", + Timeout: defaultTimeout, Path: []string{"/usr/share/snmp/mibs"}, Version: "2c", } @@ -103,9 +104,6 @@ func (s *SnmpTrap) Init() error { return err } case "netsnmp": - if s.Timeout == 0 { - s.Timeout = defaultTimeout - } s.transl = newNetsnmpTranslator(s.Timeout) default: return errors.New("invalid translator value")