From 2604fb684bf841189a2a23e6879329a80d7feb6d Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Tue, 10 Jan 2023 11:00:15 -0700 Subject: [PATCH] fix(agent): Only set default snmp after reading all configs (#12457) --- config/config.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 8ea1fe541..20c817fa4 100644 --- a/config/config.go +++ b/config/config.go @@ -426,6 +426,11 @@ func (c *Config) LoadAll(configFiles ...string) error { sort.Stable(c.Processors) sort.Stable(c.AggProcessors) + // Set snmp agent translator default + if c.Agent.SnmpTranslator == "" { + c.Agent.SnmpTranslator = "netsnmp" + } + // Let's link all secrets to their secret-stores return c.LinkSecrets() } @@ -482,10 +487,6 @@ func (c *Config) LoadConfigData(data []byte) error { Notice: "Use 'gosmi' instead", }) } - // Set snmp agent translator default - if c.Agent.SnmpTranslator == "" { - c.Agent.SnmpTranslator = "netsnmp" - } if len(c.UnusedFields) > 0 { return fmt.Errorf("line %d: configuration specified the fields %q, but they weren't used", tbl.Line, keys(c.UnusedFields))