Skip to content

Commit

Permalink
Return correct response code on ping input (influxdata#4875)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and otherpirate committed Mar 15, 2019
1 parent 6ae394e commit 1a7cbc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/inputs/ping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ apt-get install iputils-ping
## 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 = ""

## Specify the ping executable binary, default is "ping"
# binary = "ping"

## Arguments for ping command
## when arguments is not empty, other options (ping_interval, timeout, etc) will be ignored
# arguments = ["-c", "3"]
```

### Metrics:
Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/ping/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (p *Ping) pingToURL(u string, acc telegraf.Accumulator) {
if exitError, ok := err.(*exec.ExitError); ok {
if ws, ok := exitError.Sys().(syscall.WaitStatus); ok {
status = ws.ExitStatus()
fields["result_code"] = status
}
}

Expand Down

0 comments on commit 1a7cbc0

Please sign in to comment.