Enabling the ping_interval line generates error and fails.
Default configuration file
+
# +++
[[inputs.ping]]
## List of urls to ping
urls = ["www.google.com"] # required
## number of pings to send per collection (ping -c <COUNT>)
count = 1
## interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>)
ping_interval = 1.0
## per-ping timeout, in s. 0 == no timeout (ping -W <TIMEOUT>)
# timeout = 1.0
## interface to send ping from (ping -I <INTERFACE>)
# interface = ""
Telegraf version: 1.3.2,
OS: Windows 8 - 64-bit
ping plugin specific lines in the inputs sectioncount and ping_intervalKhaled@VM81-64 C:\Users\Khaled\Downloads\telegraf-1.3.2_windows_amd64\telegraf
$ telegraf.exe --config telegraf.conf --test --input-filter ping
* Plugin: inputs.ping, Collection 1
> ping,url=www.google.com,host=VM81-64 packets_transmitted=1i,reply_received=1i,packets_received=1i,percent_packet_loss=0,percent_reply_loss=0,average_response_ms=59,minimum_response_ms=59,maximum_response_ms=59 1497629721000000000
Khaled@VM81-64 C:\Users\Khaled\Downloads\telegraf-1.3.2_windows_amd64\telegraf
$ telegraf.exe --config telegraf.conf --input-filter ping --test
2017/06/16 22:00:22 E! Error parsing telegraf.conf, line 224: field corresponding to `ping_interval' is not defined in `*ping.Ping'
Turns out ping plugin on Windows don't have the option to mention the interval.
Also, FYI, it also fails with the count line commented. There should be a default count value.
$ telegraf.exe --usage ping
# Ping given url(s) and return statistics
[[inputs.ping]]
## urls to ping
urls = ["www.google.com"] # required
## number of pings to send per collection (ping -n <COUNT>)
count = 4 # required
## Ping timeout, in seconds. 0 means default timeout (ping -w <TIMEOUT>)
Timeout = 0
In that case, this should be marked as a missing feature.
for anyone interested, relevant code is here: https://github.com/influxdata/telegraf/blob/master/plugins/inputs/ping/ping_windows.go#L40
As a quick improvement I added a comment that ping_interval does not work in Windows. https://github.com/influxdata/telegraf/commit/ba364988dec019cce1df16d0a90e75722e766215
I think this is probably all we should do for this option. For the count option, I set the value to 1.
awesome @danielnelson; that was quick !
I haven't actually tested it, since I don't have a Windows machine. Maybe you could give it a spin sometime after tonight (only builds once each night).
https://dl.influxdata.com/telegraf/nightlies/telegraf-nightly_windows_amd64.zip
@danielnelson it works perfectly with the nightly (version 1.3.0~n201705270831), thanks.
Just a nit-pick, can't we just "default" the count to 1 for Windows, to skip mentioning it in config in that case?
I did this as part of the patch so you should be fine to remove the count option.
Most helpful comment
As a quick improvement I added a comment that
ping_intervaldoes not work in Windows. https://github.com/influxdata/telegraf/commit/ba364988dec019cce1df16d0a90e75722e766215I think this is probably all we should do for this option. For the count option, I set the value to 1.