From 34c4f4bf53a731a01c490494809abdd6a2106b11 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Mon, 14 Mar 2016 10:28:01 +0000 Subject: [PATCH] influxdb output: If all write fails, trigger a reconnect closes #836 --- plugins/outputs/influxdb/influxdb.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/outputs/influxdb/influxdb.go b/plugins/outputs/influxdb/influxdb.go index 5eef553a2..fca6b1db1 100644 --- a/plugins/outputs/influxdb/influxdb.go +++ b/plugins/outputs/influxdb/influxdb.go @@ -191,6 +191,12 @@ func (i *InfluxDB) Write(metrics []telegraf.Metric) error { break } } + + // If all of the writes failed, create a new connection array so that + // i.Connect() will be called on the next gather. + if err != nil { + i.conns = make([]client.Client) + } return err }