Increase ping timeout based on ping count and interval

This commit is contained in:
kodek 2016-06-01 01:06:55 -07:00 committed by Cameron Sparr
parent 137843b2f6
commit 4cd1f7a104
1 changed files with 2 additions and 1 deletions

View File

@ -76,7 +76,8 @@ func (p *Ping) Gather(acc telegraf.Accumulator) error {
go func(u string) { go func(u string) {
defer wg.Done() defer wg.Done()
args := p.args(u) 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 { if err != nil {
// Combine go err + stderr output // Combine go err + stderr output
errorChannel <- errors.New( errorChannel <- errors.New(