[ntp:questions] Re: ntp monitoring

Tapio Sokura oh2kku at iki.fi
Fri Sep 2 10:15:08 UTC 2005


VORMS THIERRY Externe wrote:
> We want to monitor a list of ntp server with stratum 2.
>  
> Is that some specifics tool for doing that ?

It depends on what exactly you want to monitor and what to do with the 
information from the monitoring. You could use for example Nagios 
(http://www.nagios.org/) that is a general purpose monitoring tool. You 
then either write your own or use existing monitoring plugins (such as 
check_ntp.pl supplied in nagios-plugins) that check the services you 
want to monitor and when there is trouble, Nagios will send an email/SMS 
or whatever you want it to do.

Nagios might be a bit like shooting a fly with a cannon here, but once 
it is setup, it works nicely and it is easy to add other services to the 
monitoring.

> I try to parse the result of ntpq -pn but I think it is not the right
> tool.

It depends on what you want to do. With ntpq -pn you can check that the 
NTP server you are querying is receiving time from its parent servers. 
This might serve as an early warning system, for example you could 
decide that at least four of the configured seven upstream NTP servers 
have to be reachable, with low startum and with small enough offsets 
between them. If only three or less are reachable, report an error 
condition. At this stage the actual quality of time is not affected much 
and you get to correct the situation before time actually starts drifting.

If you want to check the time offset, you might want to send a normal 
ntp client query/response and check that a few key variables are ok 
(offset compared to the time on the monitoring machine small enough, low 
enough startum, leap indicator bits indicate synchronized state, etc). 
There's a perl script at http://www.kloth.net/software/sntp.php that 
might be a good starting point for this. I would probably monitor using 
both ways, via ntpq -pn (output is parsed by a custom script) and direct 
NTP query.

   Tapio




More information about the questions mailing list