diff --git a/plugins/inputs/ping/ping.go b/plugins/inputs/ping/ping.go index 3368a25e054b7..58084a016be69 100644 --- a/plugins/inputs/ping/ping.go +++ b/plugins/inputs/ping/ping.go @@ -5,6 +5,7 @@ package ping import ( "errors" "os/exec" + "runtime" "strconv" "strings" "sync" @@ -133,7 +134,12 @@ func (p *Ping) args(url string) []string { args = append(args, "-i", strconv.FormatFloat(p.PingInterval, 'f', 1, 64)) } if p.Timeout > 0 { - args = append(args, "-t", strconv.FormatFloat(p.Timeout, 'f', 1, 64)) + switch runtime.GOOS { + case "darwin", "freebsd": + args = append(args, "-t", strconv.FormatFloat(p.Timeout, 'f', 1, 64)) + case "linux": + args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', 1, 64)) + } } if p.Interface != "" { args = append(args, "-I", p.Interface)