On 2013-08-01 at 00:58 -0700, James Patterson wrote:
> 2. To determine the health of the ntp service on a server we parse the
> output of ntpq -pn and look for large offsets. This doesn't make a lot
> of sense to me since ntp will ignore crazy servers. What's the best way
> of asking ntpd if it is receiving time from a good time source?

The check_ntp_peer suggestion is good, since it's a C program which
speaks the NTP control protocol enough to parse out some status from
remote servers, thus can report on many machines at once.  You don't
need to use it with Nagios.

Otherwise, how about:

  ntpdc -c sysinfo | grep -q $'^stratum:[ \t]*[2-4]$'
  echo $?

If the stratum is 2, 3, or 4, then exit okay, else exit error.

For command-line munging, "ntpdc -c sysinfo" is helpful.

-Phil
_______________________________________________
pool mailing list
[email protected]
http://lists.ntp.org/listinfo/pool

Reply via email to