I have the following ntp check on my server for Nagios via NRPE
/usr/local/nagios/nrpe_plugins/check_ntp_time -H localhost -w 0.5 -c 1 -q
When changing the date manually via the date command to a date far in the past:
date --set="16 JAN 2017 15:00:00"
The check is always giving an OK state output
NTP OK: Offset -1.442432404e-05 secs|offset=-0.000014s;0.500000;1.000000;
Despite the offset
remote refid st t when poll reach delay offset jitter
==============================================================================
10.7.100.65 176.58.109.199 3 u 4971 64 7 0.246 6136468 4339138
10.8.100.65 188.114.116.1 3 u 4971 64 7 1.571 6136468 4339138
10.7.91.41 217.114.59.66 3 u 4971 64 7 0.256 6136468 4339138
I don't understand the behavior here.
I am using the latest version of the check_ntp_time, but I have the same behavior with other versions as well.
check_ntp_time v2.2.0 (nagios-plugins 2.2.0) Copyright (c) 2006 Sean
Finney Copyright (c) 2006-2014 Nagios Plugin Development Team
Thank you in advance for your help,
Best Answer
From the
check_ntp_time --help
output:This plugin compares the time on
localhost
with the time on the host specified via-H
. When you run it ascheck_ntp_time -H localhost
, you're comparing it to itself. (This is why the difference is nearly zero.)It seems like you probably want
check_ntp_peer
instead.Alternatively, you can just use
check_ntp_time
to compare remote hosts (that run NTP servers) against your Nagios box, or run it via NRPE to compare those hosts against some other valid NTP server (e.g., time.nist.gov, time.apple.com, pool.ntp.org, whatever).