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

@@ -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)