diff --git a/plugins/inputs/snmp_heartbeat/snmp_heartbeat.go b/plugins/inputs/snmp_heartbeat/snmp_heartbeat.go index 98e30812705ed..54512cf6ff550 100644 --- a/plugins/inputs/snmp_heartbeat/snmp_heartbeat.go +++ b/plugins/inputs/snmp_heartbeat/snmp_heartbeat.go @@ -435,6 +435,7 @@ func (s *Snmp) Gather(acc telegraf.Accumulator) error { rtr.Fields["snmp_error_description"] = err.Error() rt.Rows = append(rt.Rows, rtr) acc.AddFields(rt.Name, rtr.Fields, rtr.Tags, rt.Time) + break } else { fields := s.pingToURLNative(gs.Host(), acc, period) if retries < int64(s.ProcessRetries) && fields["target_state"] == "Down" { @@ -444,10 +445,13 @@ func (s *Snmp) Gather(acc telegraf.Accumulator) error { } fields["snmp_error_description"] = err.Error() acc.AddFields(rt.Name, fields, rtr.Tags, rt.Time) + break } } else { acc.AddError(fmt.Errorf("agent %s: %w", agent, err)) } + } else { + break } }