Skip to content

Commit

Permalink
fix(inputs.snmp): Avoid sending a nil to gosmi's GetEnumBitsFormatted
Browse files Browse the repository at this point in the history
There is an upstream PR to resolve an issue when a nil value is passed.
However that PR has not been looked at or merged. As such, this attempts
to catch that scenario in Telegraf first.

See: sleepinggenius2/gosmi#45

fixes: influxdata#15200
  • Loading branch information
powersj committed Aug 14, 2024
1 parent 371b988 commit 42fba65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/snmp/translator_gosmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ func (g *gosmiTranslator) SnmpTable(oid string) (
}

func (g *gosmiTranslator) SnmpFormatEnum(oid string, value interface{}, full bool) (string, error) {
if value == nil {
return "", nil
}

//nolint:dogsled // only need to get the node
_, _, _, _, node, err := snmpTranslateCall(oid)

if err != nil {
return "", err
}
Expand Down

0 comments on commit 42fba65

Please sign in to comment.