fix(agent): Only set default snmp after reading all configs (#12457)

This commit is contained in:
Joshua Powers 2023-01-10 11:00:15 -07:00 committed by GitHub
parent 82bf8497f1
commit 2604fb684b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -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))