Skip to content

Commit

Permalink
Adding a retry to the initial telegraf database connection
Browse files Browse the repository at this point in the history
Fixes #187
  • Loading branch information
sparrc committed Sep 19, 2015
1 parent 450f5e0 commit 82d9141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 82d9141

Please sign in to comment.