I noticed that if an host is down, the the packet loss (pl) perfdata from its hostalive check will differ depending of the exact reason the host is down.
If the packets are just lost, the check will output pl = 100%, but if the cause is known (based on the ICMP response code, I suppose) there will be no perfdata at all. Some examples are Time to live exceeded or Host Unreachable.
I’m using those checks for WAN monitoring, on a large fleet of remote devices, and I need my historical data to reflect that those packets were actually lost - regardless of the reason.
Is there any way to get the check to provide packet loss data in all “down” scenarios?
You may want to consider using check_icmp, if possible:
$ /usr/lib64/nagios/plugins/check_icmp 8.8.8.8 -l 4
CRITICAL - 8.8.8.8: Time to live exceeded in transit @ w.x.y.z. rta nan, lost 100%|rta=0.000ms;200.000;500.000;0; pl=100%;40;80;0;100 rtmax=0.000ms;;;; rtmin=0.000ms;;;;
Thanks! It does the job, but it seems that the version of check_icmp bundled with Icinga2 does not support ipv6. I’m checking if I can use the one form monitoring-plugins.org.