From ab5cc55ec10c03d32edb186c99218237221367f6 Mon Sep 17 00:00:00 2001 From: sandeep-vunet <71425043+sandeep-vunet@users.noreply.github.com> Date: Mon, 31 Jan 2022 18:46:31 +0530 Subject: [PATCH] ER 2733 : Untracked snmp error in telegraf snmp_heartbeat (#14) --- plugins/inputs/snmp_heartbeat/snmp_heartbeat.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) {