Adding a retry to the initial telegraf database connection

Fixes #187
This commit is contained in:
Cameron Sparr 2015-09-18 18:02:16 -07:00
parent 450f5e03a5
commit 82d914149e
2 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,7 @@ a naming consistency issue, so cpu_percentageIdle will become cpu_usage_idle
- [#181](https://github.com/influxdb/telegraf/issues/181): Makefile GOBIN support. Thanks @Vye!
- [#203](https://github.com/influxdb/telegraf/pull/200): AMQP output. Thanks @ekini!
- [#182](https://github.com/influxdb/telegraf/pull/182): OpenTSDB output. Thanks @rplessl!
- [#187](https://github.com/influxdb/telegraf/pull/187): Retry output sink connections on startup.
### Bugfixes
- [#170](https://github.com/influxdb/telegraf/issues/170): Systemd support

View File

@ -89,7 +89,12 @@ func (a *Agent) Connect() error {
}
err := o.output.Connect()
if err != nil {
return err
log.Printf("Failed to connect to output %s, retrying in 15s\n", o.name)
time.Sleep(15 * time.Second)
err = o.output.Connect()
if err != nil {
return err
}
}
if a.Debug {
log.Printf("Successfully connected to output: %s\n", o.name)