Check_ntp_time can't create socket connection

Hi all:

I’m doing ntp time checks against the north american pool.ntp.org servers and on 2.north-america.pool.ntp.org only (and by name only) I’m getting “can’t create socket connection”:

My check works fine on the 0.north-america.pool.ntp.org, 1.north… and 3.north… servers.

Even weirder, if I nslookup 2.north-america.pool.ntp.org, and use the IP addresses rather than the name, it works fine.

I’m stumped. I’m running nagios core 3.2.3 release 3.el5.rf and nagios-plugins 1.4.15 release 2.el5.rf on Centos.

Thanks in advance for any help

Larry

Here’s what I’m seeing:

$ /usr/lib64/nagios/plugins/check_ntp_time -H 2.north-america.pool.ntp.org -w 2 -c 3
can’t create socket connection

$ /usr/lib64/nagios/plugins/check_ntp_time -v -H 2.north-america.pool.ntp.org -w 2 -c 3
can’t create socket connection

Verbose doesn’t help]

$ /usr/lib64/nagios/plugins/check_ntp_time -H 0.north-america.pool.ntp.org -w 2 -c 3
NTP OK: Offset -0.009715199471 secs|offset=-0.009715s;2.000000;3.000000;

$ /usr/lib64/nagios/plugins/check_ntp_time -H 1.north-america.pool.ntp.org -w 2 -c 3
NTP OK: Offset -0.02538263798 secs|offset=-0.025383s;2.000000;3.000000;

$ /usr/lib64/nagios/plugins/check_ntp_time -H 3.north-america.pool.ntp.org -w 2 -c 3
NTP OK: Offset 0.01100516319 secs|offset=0.011005s;2.000000;3.000000;

$ nslookup 2.north-america.pool.ntp.org

Non-authoritative answer:
Name: 2.north-america.pool.ntp.org
Address: 67.223.229.211
Name: 2.north-america.pool.ntp.org
Address: 24.189.23.61
Name: 2.north-america.pool.ntp.org
Address: 38.229.71.1

$ /usr/lib64/nagios/plugins/check_ntp_time -H 67.223.229.211 -w 2 -c 3
NTP OK: Offset -0.04489481449 secs|offset=-0.044895s;2.000000;3.000000;

$ /usr/lib64/nagios/plugins/check_ntp_time -H 24.189.23.61 -w 2 -c 3
NTP OK: Offset -0.04237174988 secs|offset=-0.042372s;2.000000;3.000000;

$ /usr/lib64/nagios/plugins/check_ntp_time -H 38.229.71.1 -w 2 -c 3
NTP OK: Offset 0.03534674644 secs|offset=0.035347s;2.000000;3.000000;

by name, it still fails:

$ /usr/lib64/nagios/plugins/check_ntp_time -H 2.north-america.pool.ntp.org -w 2 -c 3
can’t create socket connection

$ echo $?
3

$ /usr/lib64/nagios/plugins/check_ntp_time -H 1.north-america.pool.ntp.org -w 2 -c 3
NTP OK: Offset -0.01851987839 secs|offset=-0.018520s;2.000000;3.000000;

$ echo $?
0

Here’s a successful verbose query, if that helps:

$ /usr/lib64/nagios/plugins/check_ntp_time -v -H 0.north-america.pool.ntp.org -w 2 -c 3
sending request to peer 0
sending request to peer 1
response from peer 0: offset -0.01433885098
sending request to peer 0
sending request to peer 2
response from peer 1: offset -0.02988278866
sending request to peer 1
response from peer 0: offset 0.09048914909
sending request to peer 0
response from peer 2: offset 0.04916787148
sending request to peer 2
response from peer 0: offset 0.1249713898
sending request to peer 0
response from peer 2: offset 0.0510571003
sending request to peer 2
response from peer 0: offset 0.03016650677
re-sending request to peer 1
response from peer 2: offset -0.009654164314
sending request to peer 2
response from peer 1: offset -0.0107806921
sending request to peer 1
response from peer 2: offset -0.01962029934
response from peer 1: offset 0.01060569286
sending request to peer 1
response from peer 1: offset 0.04727256298
overall average offset: -0.02988278866
NTP OK: Offset -0.02988278866 secs|offset=-0.029883s;2.000000;3.000000;

I’m thinking it’s something about the plugin, since this error message is in the check_ntp_time file and ntp checks of all the pool servers work when using ntpdate:

ntpdate -q 0.north-america.pool.ntp.org

server 66.172.42.32, stratum 2, offset -0.006877, delay 0.09203
server 69.164.206.65, stratum 3, offset -0.009902, delay 0.09460
server 72.18.205.156, stratum 3, offset -0.008259, delay 0.10002
30 Jun 12:29:18 ntpdate[16795]: adjust time server 66.172.42.32 offset -0.006877 sec

ntpdate -q 1.north-america.pool.ntp.org

server 63.141.244.130, stratum 2, offset -0.011975, delay 0.12502
server 69.64.37.141, stratum 2, offset -0.019265, delay 0.11304
server 69.65.40.29, stratum 2, offset -0.011195, delay 0.10620
30 Jun 12:29:23 ntpdate[16805]: adjust time server 69.65.40.29 offset -0.011195 sec

]# ntpdate -q 3.north-america.pool.ntp.org
server 148.167.132.200, stratum 2, offset 0.003052, delay 0.10400
server 204.235.61.9, stratum 2, offset 0.002897, delay 0.13901
server 206.217.140.200, stratum 3, offset -0.015977, delay 0.11668
30 Jun 12:29:28 ntpdate[16826]: adjust time server 148.167.132.200 offset 0.003052 sec

ntpdate -q 2.north-america.pool.ntp.org

server 38.117.195.101, stratum 3, offset -0.005753, delay 0.15460
server 97.107.134.28, stratum 3, offset -0.021680, delay 0.14912
server 216.45.57.38, stratum 2, offset -0.009028, delay 0.13000
30 Jun 12:29:32 ntpdate[16836]: adjust time server 216.45.57.38 offset -0.009028 sec

Works!

Just to be sure, I tried the plugin as root:

/usr/lib64/nagios/plugins/check_ntp_time -v -H 2.north-america.pool.ntp.org -w 1 -c 2

can’t create socket connection

Thanks

Larry Hays
Network Manager
US District Court, District of New Mexico

I’m running an identical configuration and experiencing the same results. Try adding a parameter “-4” to your check. I remember seeing that pool 2 for the NTP servers has IPv6 addresses assigned which are used by default.

That did it. Thanks TimbCFCA!

Larry

Thanks timbCFCA! That worked for me also.