Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove log message on ping timeout #3126

Merged
merged 1 commit into from
Aug 16, 2017
Merged

Conversation

danielnelson
Copy link
Contributor

If the ping executable returns with exit status 1, don't report an error yet and try to parse output. If the exit status is not 1 return without trying to parse, this is a change from the current behavior.

Here are some output examples:

[[inputs.ping]]
  urls = ["timeout.example.org", "8.8.8.8"]
  count = 1
$ ./telegraf --test
> ping,url=8.8.8.8 packets_transmitted=1i,packets_received=1i,percent_packet_loss=0,minimum_response_ms=14.791,average_response_ms=14.791,maximum_response_ms=14.791 1502758914000000000
> ping,url=timeout.example.org packets_transmitted=1i,packets_received=0i,percent_packet_loss=100 1502758915000000000
$ PATH= ./telegraf --test
2017-08-15T01:02:07Z E! Error in plugin [inputs.ping]: exec: "ping": executable file not found in $PATH
2017-08-15T01:02:07Z E! Error in plugin [inputs.ping]: exec: "ping": executable file not found in $PATH
$ cat ping
#!/bin/sh
echo not the right output

$ PATH=. ./telegraf --test
2017-08-15T00:47:26Z E! Error in plugin [inputs.ping]: Fatal error processing ping output: timeout.example.org
2017-08-15T00:47:26Z E! Error in plugin [inputs.ping]: Fatal error processing ping output: 8.8.8.8

$ chmod -r ping
$ PATH=. ./telegraf --test
2017-08-15T01:02:24Z E! Error in plugin [inputs.ping]: /bin/sh: ping: Permission denied, exit status 126
2017-08-15T01:02:24Z E! Error in plugin [inputs.ping]: /bin/sh: ping: Permission denied, exit status 126

closes #1654

Required for all PRs:

  • Has appropriate unit tests.

@danielnelson danielnelson added this to the 1.4.0 milestone Aug 15, 2017
@danielnelson danielnelson merged commit eb0215c into master Aug 16, 2017
@danielnelson danielnelson deleted the ping-no-error-on-timeout branch August 16, 2017 18:59
maxunt pushed a commit that referenced this pull request Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ping logs a parse error on timeout
1 participant