From 4cd1f7a104881a20cb580bfa477f3bfdbb1d4f4e Mon Sep 17 00:00:00 2001 From: kodek Date: Wed, 1 Jun 2016 01:06:55 -0700 Subject: [PATCH] Increase ping timeout based on ping count and interval --- plugins/inputs/ping/ping.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/ping/ping.go b/plugins/inputs/ping/ping.go index dfe67dc3f..cf148e1f6 100644 --- a/plugins/inputs/ping/ping.go +++ b/plugins/inputs/ping/ping.go @@ -76,7 +76,8 @@ func (p *Ping) Gather(acc telegraf.Accumulator) error { go func(u string) { defer wg.Done() args := p.args(u) - out, err := p.pingHost(p.Timeout, args...) + totalTimeout := float64(p.Count)*p.Timeout + float64(p.Count-1)*p.PingInterval + out, err := p.pingHost(totalTimeout, args...) if err != nil { // Combine go err + stderr output errorChannel <- errors.New(