From b4a0c854f50b4276949fd124639178e059d2ba37 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Wed, 6 Jun 2018 14:28:12 -0700 Subject: [PATCH] Use same flags for all bsd family ping varients (#4241) (cherry picked from commit 7fe6e2f5ae93d1a784fa4795fde92d2e342a3da7) --- plugins/inputs/ping/ping.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/inputs/ping/ping.go b/plugins/inputs/ping/ping.go index f347fa3d6..492474786 100644 --- a/plugins/inputs/ping/ping.go +++ b/plugins/inputs/ping/ping.go @@ -175,7 +175,7 @@ func (p *Ping) args(url string) []string { } if p.Timeout > 0 { switch runtime.GOOS { - case "darwin": + case "darwin", "freebsd", "netbsd", "openbsd": args = append(args, "-W", strconv.FormatFloat(p.Timeout*1000, 'f', -1, 64)) case "linux": args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', -1, 64)) @@ -186,7 +186,7 @@ func (p *Ping) args(url string) []string { } if p.Deadline > 0 { switch runtime.GOOS { - case "darwin": + case "darwin", "freebsd", "netbsd", "openbsd": args = append(args, "-t", strconv.Itoa(p.Deadline)) case "linux": args = append(args, "-w", strconv.Itoa(p.Deadline)) @@ -197,10 +197,10 @@ func (p *Ping) args(url string) []string { } if p.Interface != "" { switch runtime.GOOS { + case "darwin", "freebsd", "netbsd", "openbsd": + args = append(args, "-S", p.Interface) case "linux": args = append(args, "-I", p.Interface) - case "freebsd", "darwin": - args = append(args, "-S", p.Interface) default: // Not sure the best option here, just assume GNU ping? args = append(args, "-I", p.Interface)