Skip to content

Commit

Permalink
Use same flags for all bsd family ping varients (#4241)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson authored Jun 6, 2018
1 parent a4214ab commit 7fe6e2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/inputs/ping/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand All @@ -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)
Expand Down

0 comments on commit 7fe6e2f

Please sign in to comment.