check_icmp: keep performance data order in case of none-reachable hosts
commit0488426c7e8018d77734fb0e46328182de28f76a
authorSven Nierlein <sven@consol.de>
Wed, 28 Feb 2024 14:37:27 +0000 (28 15:37 +0100)
committerSven Nierlein <sven@nierlein.org>
Fri, 1 Mar 2024 08:03:17 +0000 (1 09:03 +0100)
tree157d97cab7fdeabdab304af540e40de92774b3d7
parent117cd8e4b826e471e795536228628d817df33f5a
check_icmp: keep performance data order in case of none-reachable hosts

For responding hosts nothing changes:

    ./check_icmp -H 10.0.0.1
    OK - 10.0.0.1 rta 0.336ms lost 0%|rta=0.336ms;200.000;500.000;0; rtmax=0.471ms;;;; rtmin=0.000ms;;;; pl=0%;40;80;0;100

In case the host is down, the performance data now contain 'U' according to:
https://www.monitoring-plugins.org/doc/guidelines.html#AEN201

Old:
    ./check_icmp -H 10.0.0.99
    CRITICAL - 10.0.0.99: Host unreachable @ 10.0.1.138. rta nan, lost 100%|pl=100%;40;80;0;100

Old:
    ./check_icmp -H 10.0.0.99
    CRITICAL - 10.0.0.99: Host unreachable @ 10.0.1.138. rta nan, lost 100%|rta=U;;;; rtmax=U;;;; rtmin=U;;;; pl=100%;40;80;0;100

This confuses some performance graphing tools, ex.: pnp.

Signed-off-by: Sven Nierlein <sven@consol.de>
plugins-root/check_icmp.c
plugins-root/t/check_icmp.t