Wrong Packet Loss report from nagios check ping plugin

Hi there,
the nagios check_ping command gives me unlogical reports about the packet loss, like subscribed in this topic:
https://monitoring-portal.org/woltlab/index.php?thread/42493-hostalive-check-with-5-pings-return-16-packet-loss-after-1-5/&postID=259394 1

18.04 Bionic(fresh installed) with Icinga2 V2.10 and nagios-plugins-basic V2.2

It seems to be an error in the check_ping plugin. By default it is sending 5 packets for icmp echo request. If just one packet fail i get packet loss values like 16%, 95%, etc. But when there are 5 packets and one fail, that have to be 20% in my world. The Plugin output is only right if 100% fail or none. Otherwise it gives random values. I checked the process by executing tcpdump on the remotesystem. The count of packets(icmp requests) is correct, if i set the -p parameter to 2 packets, the check_command is sending 2, but the output of packet loss is still not logical. Using the check_icmp is no option for me at the moment, i really want to know how to fix this :slight_smile:

I took a look at the c code of the plugin, but my programming skills are to bad for find something. I also found some topics about this problem, but no one had an idea how to correct that. In my opinion i tried everything, without success. I really hope that someone here can help.

I think it is not necessary to post my whole config snippets here cause everyone can easily reproduce this. I just executed the check command manually for that during i interrupt the network connection of the ping target. Before i stopped icinga service to avoid any icmp requests from hostchecks that affects my tcpdump result. If i use the ping command from the terminal, everything works like expected. 1 out of 5 packets is calculated with 20%.

We are deploying an Icinga2 monitoring in our productive network at work at the moment. That is the reason why i want to fix it insted of using another ping plugin. Maybe there is an error that can be fixed within some changes on the script. I think everyone who is using nagios would be happy about that :slight_smile:

Here is the c code

If you can really pin it to the check_ping script then I would say you should open an issue on their github.

1 Like

Ok, thanks. I will do that

AFAIK check_ping calls the ping binary subsequentially and then calculating something. You might want to use check_icmp instead which fires the request in parallel and directly via TCP sockets.