Update ping input readme

This commit is contained in:
Daniel Nelson 2018-08-31 13:59:30 -07:00
parent e7b50384cf
commit ca9505a3b1
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
2 changed files with 65 additions and 49 deletions

View File

@ -1,55 +1,68 @@
# Ping Input plugin # Ping Input Plugin
This input plugin will measures the round-trip Sends a ping message by executing the system ping command and reports the results.
Currently there is no support for GNU Inetutils, use with iputils-ping
instead:
```
apt-get install iputils-ping
```
### Configuration: ### Configuration:
``` ```toml
# NOTE: this plugin forks the ping command. You may need to set capabilities
# via setcap cap_net_raw+p /bin/ping
[[inputs.ping]] [[inputs.ping]]
## List of urls to ping ## List of urls to ping
urls = ["www.google.com"] # required urls = ["example.org"]
## number of pings to send per collection (ping -c <COUNT>)
# count = 1 ## Number of pings to send per collection (ping -c <COUNT>)
## interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>) # count = 1
## Not available in Windows.
# ping_interval = 1.0 ## Interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>)
## per-ping timeout, in s. 0 == no timeout (ping -W <TIMEOUT>) ## Not available in Windows.
# timeout = 1.0 # ping_interval = 1.0
## total-ping deadline, in s. 0 == no deadline (ping -w <DEADLINE>)
# deadline = 10 ## Per-ping timeout, in s. 0 == no timeout (ping -W <TIMEOUT>)
## interface or source address to send ping from (ping -I <INTERFACE/SRC_ADDR>) # timeout = 1.0
## on Darwin and Freebsd only source address possible: (ping -S <SRC_ADDR>)
# interface = "" ## Total-ping deadline, in s. 0 == no deadline (ping -w <DEADLINE>)
# deadline = 10
## Interface or source address to send ping from (ping -I <INTERFACE/SRC_ADDR>)
## on Darwin and Freebsd only source address possible: (ping -S <SRC_ADDR>)
# interface = ""
``` ```
### Measurements & Fields: ### Metrics:
- packets_transmitted ( from ping output ) - ping
- reply_received ( increasing only on valid metric from echo replay, eg. 'Destination net unreachable' reply will increment packets_received but not reply_received ) - tags:
- packets_received ( from ping output ) - url
- percent_reply_loss ( compute from packets_transmitted and reply_received ) - fields:
- percent_packets_loss ( compute from packets_transmitted and packets_received ) - packets_transmitted (integer)
- errors ( when host can not be found or wrong parameters is passed to application ) - packets_received (integer)
- response time - percent_packets_loss (float)
- average_response_ms ( compute from minimum_response_ms and maximum_response_ms ) - average_response_ms (integer)
- minimum_response_ms ( from ping output ) - minimum_response_ms (integer)
- maximum_response_ms ( from ping output ) - maximum_response_ms (integer)
- result_code - standard_deviation_ms (integer, Not available on Windows)
- 0: success - errors (float, Windows only)
- 1: no such host - reply_received (integer, Windows only)
- 2: ping error - percent_reply_loss (float, Windows only)
- result_code (int, success = 0, no such host = 1, ping error = 2)
### Tags: ##### reply_received vs packets_received
- host On Windows systems, "Destination net unreachable" reply will increment `packets_received` but not `reply_received`.
- url
### Example Output: ### Example Output:
**Windows:**
``` ```
$ ./telegraf --config telegraf.conf --input-filter ping --test ping,url=example.org result_code=0i,average_response_ms=7i,maximum_response_ms=9i,minimum_response_ms=7i,packets_received=4i,packets_transmitted=4i,percent_packet_loss=0,percent_reply_loss=0,reply_received=4i 1469879119000000000
* Plugin: ping, Collection 1 ```
ping,host=WIN-PBAPLP511R7,url=www.google.com result_code=0i,average_response_ms=7i,maximum_response_ms=9i,minimum_response_ms=7i,packets_received=4i,packets_transmitted=4i,percent_packet_loss=0,percent_reply_loss=0,reply_received=4i 1469879119000000000
**Linux:**
```
ping,url=example.org average_response_ms=23.066,maximum_response_ms=24.64,minimum_response_ms=22.451,packets_received=5i,packets_transmitted=5i,percent_packet_loss=0,result_code=0i,standard_deviation_ms=0.809 1535747258000000000
``` ```

View File

@ -52,20 +52,23 @@ func (_ *Ping) Description() string {
} }
const sampleConfig = ` const sampleConfig = `
## NOTE: this plugin forks the ping command. You may need to set capabilities
## via setcap cap_net_raw+p /bin/ping
#
## List of urls to ping ## List of urls to ping
urls = ["www.google.com"] # required urls = ["example.org"]
## number of pings to send per collection (ping -c <COUNT>)
## Number of pings to send per collection (ping -c <COUNT>)
# count = 1 # count = 1
## 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>)
## Not available in Windows.
# ping_interval = 1.0 # ping_interval = 1.0
## per-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
## total-ping deadline, in s. 0 == no deadline (ping -w <DEADLINE>)
## Total-ping deadline, in s. 0 == no deadline (ping -w <DEADLINE>)
# deadline = 10 # deadline = 10
## interface or source address to send ping from (ping -I <INTERFACE/SRC_ADDR>)
## Interface or source address to send ping from (ping -I <INTERFACE/SRC_ADDR>)
## on Darwin and Freebsd only source address possible: (ping -S <SRC_ADDR>) ## on Darwin and Freebsd only source address possible: (ping -S <SRC_ADDR>)
# interface = "" # interface = ""
` `