Fixup ping change

fixes #1335
This commit is contained in:
Cameron Sparr 2016-06-10 12:51:43 +01:00
parent 4cd1f7a104
commit ea2521bf27
3 changed files with 6 additions and 5 deletions

View File

@ -7,6 +7,7 @@
- [#1330](https://github.com/influxdata/telegraf/issues/1330): Fix exec plugin panic when using single binary. - [#1330](https://github.com/influxdata/telegraf/issues/1330): Fix exec plugin panic when using single binary.
- [#1336](https://github.com/influxdata/telegraf/issues/1336): Fixed incorrect prometheus metrics source selection. - [#1336](https://github.com/influxdata/telegraf/issues/1336): Fixed incorrect prometheus metrics source selection.
- [#1112](https://github.com/influxdata/telegraf/issues/1112): Set default Zookeeper chroot to empty string. - [#1112](https://github.com/influxdata/telegraf/issues/1112): Set default Zookeeper chroot to empty string.
- [#1335](https://github.com/influxdata/telegraf/issues/1335): Fix overall ping timeout to be calculated based on per-ping timeout.
## v1.0 beta 1 [2016-06-07] ## v1.0 beta 1 [2016-06-07]

View File

@ -1138,7 +1138,7 @@
# count = 1 # required # count = 1 # required
# ## interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>) # ## interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>)
# ping_interval = 0.0 # ping_interval = 0.0
# ## ping timeout, in s. 0 == no timeout (ping -W <TIMEOUT>) # ## per-ping timeout, in s. 0 == no timeout (ping -W <TIMEOUT>)
# timeout = 1.0 # timeout = 1.0
# ## interface to send ping from (ping -I <INTERFACE>) # ## interface to send ping from (ping -I <INTERFACE>)
# interface = "" # interface = ""

View File

@ -28,7 +28,7 @@ type Ping struct {
// Number of pings to send (ping -c <COUNT>) // Number of pings to send (ping -c <COUNT>)
Count int Count int
// Ping timeout, in seconds. 0 means no timeout (ping -t <TIMEOUT>) // Ping timeout, in seconds. 0 means no timeout (ping -W <TIMEOUT>)
Timeout float64 Timeout float64
// Interface to send ping from (ping -I <INTERFACE>) // Interface to send ping from (ping -I <INTERFACE>)
@ -55,7 +55,7 @@ const sampleConfig = `
count = 1 # required count = 1 # required
## interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>) ## interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>)
ping_interval = 0.0 ping_interval = 0.0
## ping timeout, in s. 0 == no timeout (ping -W <TIMEOUT>) ## per-ping timeout, in s. 0 == no timeout (ping -W <TIMEOUT>)
timeout = 1.0 timeout = 1.0
## interface to send ping from (ping -I <INTERFACE>) ## interface to send ping from (ping -I <INTERFACE>)
interface = "" interface = ""
@ -139,8 +139,8 @@ func (p *Ping) args(url string) []string {
} }
if p.Timeout > 0 { if p.Timeout > 0 {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "freebsd": case "darwin":
args = append(args, "-t", strconv.FormatFloat(p.Timeout, 'f', 1, 64)) args = append(args, "-W", strconv.FormatFloat(p.Timeout/1000, 'f', 1, 64))
case "linux": case "linux":
args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', 1, 64)) args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', 1, 64))
default: default: