Page 1 of 1

'Check_ping' returns /usr/sbin/ping6 -n -U -w 10 -c 5 localh

Posted: Fri Feb 23, 2018 9:06 pm
by ados
Moderator Edit: This thread has been split from another - https://support.nagios.com/forum/viewto ... =7&t=23099

In the future, please create a new thread and link to the old one instead of adding on.


I met the same problem.

When using ip address, hostname or FQDN to check other hosts, the check is OK.
However, when using FQDN to check self, the check tries /sbin/ping6, which is not expected.

/usr/local/nagios/libexec/check_ping -V
check_ping v2.2.1 (nagios-plugins 2.2.1)

# try localhost - OK
./check_ping -H localhost -w 100,10% -c 200,20%
PING OK - Packet loss = 0%, RTA = 0.14 ms|rta=0.143000ms;100.000000;200.000000;0.000000 pl=0%;10;20;0

# try self IP address OK
./check_ping -H xxx.xxx.xxx.129 -w 100,10% -c 200,20%
PING OK - Packet loss = 0%, RTA = 0.09 ms|rta=0.091000ms;100.000000;200.000000;0.000000 pl=0%;10;20;0

# show you DNS resolution from self FQDN to self IP address
host nagios1.xxx.xxx.xxx
nagios1.xxx.xxx.xxx has address xxx.xxx.xxx.129

# try self FQDN - failed
./check_ping -H nagios1.xxx.xxx.xxx -w 100,10% -c 200,20%
/sbin/ping6 -n -U -W 10 -c 5 nagios1.xxx.xxx.xxx
CRITICAL - Could not interpret output from ping command

Re: 'Check_ping' returns /usr/sbin/ping6 -n -U -w 10 -c 5 lo

Posted: Mon Feb 26, 2018 2:33 pm
by scottwilkerson
per the check_ping help, if you want to force it to use ipv4 you need to add th -4 flag to the check command

Code: Select all

Usage:
check_ping -H <host_address> -w <wrta>,<wpl>% -c <crta>,<cpl>%
 [-p packets] [-t timeout] [-4|-6]

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.nagios-plugins.org/doc/extra-opts.html
    for usage and examples.
 -4, --use-ipv4
    Use IPv4 connection
 -6, --use-ipv6
    Use IPv6 connection