diff --git a/plugins/inputs/snmp_heartbeat/snmp_heartbeat.go b/plugins/inputs/snmp_heartbeat/snmp_heartbeat.go index 90e9bf57fcc62..c90be13159136 100644 --- a/plugins/inputs/snmp_heartbeat/snmp_heartbeat.go +++ b/plugins/inputs/snmp_heartbeat/snmp_heartbeat.go @@ -575,13 +575,16 @@ func (t Table) Build(gs snmpConnection, walk bool) (*RTable, error) { ifv := map[string]interface{}{} if !walk { - // This is used when fetching non-table fields. Fields configured a the top // scope of the plugin. // We fetch the fields directly, and add them to ifv as if the index were an // empty string. This results in all the non-table fields sharing the same // index, and being added on the same row. - if pkt, err := gs.Get([]string{oid}); err != nil { + pkt, err := gs.Get([]string{oid}) + if pkt != nil && pkt.Error.String() != "NoError" { + return nil, fmt.Errorf(pkt.Error.String()) + } + if err != nil { if errors.Is(err, gosnmp.ErrUnknownSecurityLevel) { return nil, fmt.Errorf("unknown security level (sec_level)") } else if errors.Is(err, gosnmp.ErrUnknownUsername) {