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

check_ping runs 30 times when host is down #139

Closed
rcknag opened this issue Feb 17, 2016 · 2 comments
Closed

check_ping runs 30 times when host is down #139

rcknag opened this issue Feb 17, 2016 · 2 comments
Labels

Comments

@rcknag
Copy link

rcknag commented Feb 17, 2016

When a host is down, check_ping will execute 30 times disregarding what value is set by -p. When the host is up, it is fine.

See this thread for a full tcpdump -
https://support.nagios.com/forum/viewtopic.php?f=7&t=36682&p=172260#p172340

@jfrickson jfrickson added the Bug label Oct 31, 2016
@jfrickson jfrickson self-assigned this Oct 31, 2016
jfrickson pushed a commit that referenced this issue Nov 17, 2016
Fix for issue #139

`-w` (lower-case) was being used, and it should have been
`-W` (upper-case). `-w` does not stop after `-c` count packets
have been sent, it's just a timeout. `-W` stops sending after
`-c` packets, but waits the timeout time before quitting.
@jfrickson
Copy link
Contributor

Fixed in branch 'maint' via commit b7ee01a

The ping command has both a -w and -W option. Lower-case w (which was being used) effectively ignores the -c parameter. So it has been changed to an upper-case W which will stop sending pings and just wait for the timeout.

@bardahlm
Copy link

This change broke my checks. All checks on hosts that are down now report
CRITICAL - Plugin timed out
instead of
PING CRITICAL - Packet loss = 100%|rta=500.000000ms;300.000000;500.000000;0.000000 pl=100%;20;25;0

If I set -W 15, ping still takes 24 seconds to terminate:

$ time /usr/bin/ping -n -U -W 15 -c 10 10.10.10.10
PING 10.10.10.10 (10.10.10.10) 56(84) bytes of data.

--- 10.10.10.10 ping statistics ---
10 packets transmitted, 0 received, 100% packet loss, time 9001ms

real 0m24.004s
user 0m0.002s
sys 0m0.001s

If I use -w 15, it terminates in just over 15 seconds:

$ time /usr/bin/ping -n -U -w 15 -c 10 10.10.10.10
PING 10.10.10.10 (10.10.10.10) 56(84) bytes of data.

--- 10.10.10.10 ping statistics ---
15 packets transmitted, 0 received, 100% packet loss, time 14001ms

real 0m15.002s
user 0m0.001s
sys 0m0.003s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants