diff --git a/agent.go b/agent.go index 7ac924f63..7f45e47a2 100644 --- a/agent.go +++ b/agent.go @@ -70,6 +70,7 @@ func (agent *Agent) Connect() error { Username: config.Username, Password: config.Password, UserAgent: config.UserAgent, + Timeout: config.Timeout.Duration, }) if err != nil { diff --git a/config.go b/config.go index 013b8d281..a94c1c490 100644 --- a/config.go +++ b/config.go @@ -34,6 +34,7 @@ type Config struct { Password string Database string UserAgent string + Timeout Duration Tags map[string]string agent *ast.Table @@ -243,6 +244,11 @@ url = "http://localhost:8086" # required. # The target database for metrics. This database must already exist database = "telegraf" # required. +# Connection timeout (for the connection with InfluxDB), formatted as a string. +# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". +# If not provided, will default to 0 (no timeout) +# timeout = "5s" + # username = "telegraf" # password = "metricsmetricsmetricsmetrics"