Skip to content

Commit

Permalink
Set reasonable defaults in ping plugin
Browse files Browse the repository at this point in the history
closes #1742
  • Loading branch information
sparrc committed Oct 17, 2016
1 parent 4c670f7 commit b4da486
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ continue sending logs to /var/log/telegraf/telegraf.log.
- [#1344](https://github.com/influxdata/telegraf/issues/1344): Fix config file parse error logging.
- [#1771](https://github.com/influxdata/telegraf/issues/1771): Delete nil fields in the metric maker.
- [#870](https://github.com/influxdata/telegraf/issues/870): Fix MySQL special characters in DSN parsing.
- [#1742](https://github.com/influxdata/telegraf/issues/1742): Ping input odd timeout behavior.

## v1.0.1 [2016-09-26]

Expand Down
15 changes: 10 additions & 5 deletions plugins/inputs/ping/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ const sampleConfig = `
## urls to ping
urls = ["www.google.com"] # required
## number of pings to send per collection (ping -c <COUNT>)
count = 1 # required
# count = 1
## interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>)
ping_interval = 0.0
# ping_interval = 1.0
## 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 = ""
# interface = ""
`

func (_ *Ping) SampleConfig() string {
Expand Down Expand Up @@ -200,6 +200,11 @@ func processPingOutput(out string) (int, int, float64, error) {

func init() {
inputs.Add("ping", func() telegraf.Input {
return &Ping{pingHost: hostPinger}
return &Ping{
pingHost: hostPinger,
PingInterval: 1.0,
Count: 1,
Timeout: 1.0,
}
})
}

0 comments on commit b4da486

Please sign in to comment.