Some patches for check_ntp_time

Paul Crawford paul at crawford-space.co.uk
Mon Jun 8 18:57:29 CEST 2026


Hi,
I'm not really a software developer so not completely up to speed with 
sensing git pull requests, etc, the correct way.

I was trying to use the check_ntp_time plug-in with Nagios to check some 
servers that may, or may not, allow querying (as check_ntp_perr needs) 
and I found that some simply did not yield a sensible answer with 
check_ntp_time.

It seems the very rapid pooling to get the average time difference of 
client and host time was causing the server to block after the first one 
or two responses. So I thought it worth trying to add some delay so they 
don't block the query and that seems to work (at least in my case) if 
the delay is around 0.5 seconds.

While compiling the code I saw a warning about the use of strncpy() so 
that is also fixed. It would cause the plugin to segfault if you told it 
the host was a socket such as /very...very...long...path that was over 
something like 108 bytes.

Attached are the diffs from my local git clone for the strncpy() 
bug-fix, and for the added polling delay, in case they are of use to 
improve the code base.

Regards,
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-strncpy.diff
Type: text/x-patch
Size: 981 bytes
Desc: not available
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20260608/8bcb6398/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-poll-delay.diff
Type: text/x-patch
Size: 4739 bytes
Desc: not available
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20260608/8bcb6398/attachment-0001.bin>


More information about the Devel mailing list