From aeffacbe4a84d35603ec8a5ed6590a4d692209f9 Mon Sep 17 00:00:00 2001 From: Cosmo Petrich Date: Mon, 30 Jan 2017 09:28:52 +1100 Subject: [PATCH] Increment gather_errors for all input errors closes #2339 --- CHANGELOG.md | 1 + agent/agent.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62f693c55..3cdd544d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ It is highly recommended that all users migrate to the new riemann output plugin - [#2277](https://github.com/influxdata/telegraf/pull/2277): add integer metrics for Consul check health state. - [#2201](https://github.com/influxdata/telegraf/pull/2201): Add lock option to the IPtables input plugin. - [#2244](https://github.com/influxdata/telegraf/pull/2244): Support ipmi_sensor plugin querying local ipmi sensors. +- [#2339](https://github.com/influxdata/telegraf/pull/2339): Increment gather_errors for all errors emitted by inputs. ### Bugfixes diff --git a/agent/agent.go b/agent/agent.go index a9e42643a..192e8c112 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -157,13 +157,13 @@ func gatherWithTimeout( select { case err := <-done: if err != nil { - log.Printf("E! ERROR in input [%s]: %s", input.Name(), err) + acc.AddError(err) } return case <-ticker.C: - log.Printf("E! ERROR: input [%s] took longer to collect than "+ - "collection interval (%s)", - input.Name(), timeout) + err := fmt.Errorf("took longer to collect than collection interval (%s)", + timeout) + acc.AddError(err) continue case <-shutdown: return