xref: /netbsd-src/external/bsd/ntp/dist/scripts/monitoring/README (revision abb0f93cd77b67f080613360c65701f85e5f5cfe)
1*abb0f93cSkardelThis directory contains support for monitoring the local clock of xntp daemons.
2*abb0f93cSkardel
3*abb0f93cSkardelWARNING: The scripts and routines contained in this directory are beta
4*abb0f93cSkardel	 release!  Do not depend on their correct operation. They are,
5*abb0f93cSkardel	 however, in regular use at University of Erlangen-Nuernberg.
6*abb0f93cSkardel	 No severe problems are known for this code.
7*abb0f93cSkardel
8*abb0f93cSkardel!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9*abb0f93cSkardelPLEASE THINK TWICE BEFORE STARTING MONITORING REMOTE XNTP DEAMONS !!!!
10*abb0f93cSkardelMONITORING MAY INCREASE THE LOAD OF THE DEAMON MONITORED AND MAY
11*abb0f93cSkardelINCREASE THE NETWORK LOAD SIGNIFICANTLY
12*abb0f93cSkardel!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13*abb0f93cSkardel
14*abb0f93cSkardel
15*abb0f93cSkardelFiles are:
16*abb0f93cSkardel
17*abb0f93cSkardelREADME:
18*abb0f93cSkardel	This file
19*abb0f93cSkardel
20*abb0f93cSkardelntptrap:
21*abb0f93cSkardel	perl script to log ntp mode 6 trap messages.
22*abb0f93cSkardel
23*abb0f93cSkardel	It sends a set_trap request to each server given and dumps the
24*abb0f93cSkardel	trap messages received. It handles refresh of set_trap.
25*abb0f93cSkardel	Currently it handles only NTP V2, however the NTP V3 servers
26*abb0f93cSkardel	also accept v2 requests. It will not interpret v3 system and
27*abb0f93cSkardel	peer stati correctly.
28*abb0f93cSkardel
29*abb0f93cSkardel	usage:
30*abb0f93cSkardel	  ntptrap [-n] [-p <port>] [-l <debug-output>] servers...
31*abb0f93cSkardel
32*abb0f93cSkardel	-n:		do not send set_trap requests
33*abb0f93cSkardel
34*abb0f93cSkardel	port:		port to listen for responses
35*abb0f93cSkardel			useful if you have a configured trap
36*abb0f93cSkardel
37*abb0f93cSkardel	debug-output:	file to write trace output to (for debugging)
38*abb0f93cSkardel
39*abb0f93cSkardel	This script convinced me that ntp trap messages are only of
40*abb0f93cSkardel	little use.
41*abb0f93cSkardel
42*abb0f93cSkardelntploopstat:
43*abb0f93cSkardel	perl script to gather loop info statistics from xntpd via mode 7
44*abb0f93cSkardel	LOOP_INFO requests.
45*abb0f93cSkardel
46*abb0f93cSkardel	This script collects data to allow monitoring of remote xntp servers
47*abb0f93cSkardel	where it is not possible to directly access the loopstats file
48*abb0f93cSkardel	produced by xntpd itself. Of course, it can be used to sample
49*abb0f93cSkardel	a local server if it is not configured to produce a loopstats file.
50*abb0f93cSkardel
51*abb0f93cSkardel	Please note, this program poses a high load on the server as
52*abb0f93cSkardel	a communication takes place every delay seconds ! USE WITH CARE !
53*abb0f93cSkardel
54*abb0f93cSkardel	usage:
55*abb0f93cSkardel	  ntploopstat [-d<delay>] [-t<timeout>] [-l <logfile>] [-v] [ntpserver]
56*abb0f93cSkardel
57*abb0f93cSkardel	delay:		number of seconds to wait between samples
58*abb0f93cSkardel			default: 60 seconds
59*abb0f93cSkardel	timeout:	number of seconds to wait for reply
60*abb0f93cSkardel			default 12 seconds
61*abb0f93cSkardel	logfile:	file to log samples to
62*abb0f93cSkardel			default: loopstats:<ntpserver>:
63*abb0f93cSkardel			(note the trailing colon)
64*abb0f93cSkardel			This name actually is a prefix.
65*abb0f93cSkardel			The file name is dynamically derived by appending
66*abb0f93cSkardel			the name of the month the sample belongs to.
67*abb0f93cSkardel			Thus all samples of a month end up in the same file.
68*abb0f93cSkardel
69*abb0f93cSkardel	the format of the files generated is identical to the format used by
70*abb0f93cSkardel	xntpd with the loopstats file:
71*abb0f93cSkardel		MJD <seconds since midnight UTC> offset frequency compliance
72*abb0f93cSkardel
73*abb0f93cSkardel	if a timeout occurs the next sample is tried after delay/2 seconds
74*abb0f93cSkardel
75*abb0f93cSkardel	The script will terminate after MAX_FAIL (currently 60)
76*abb0f93cSkardel	consecutive errors.
77*abb0f93cSkardel
78*abb0f93cSkardel	Errors are counted for:
79*abb0f93cSkardel		- error on send call
80*abb0f93cSkardel		- error on select call
81*abb0f93cSkardel		- error on recv call
82*abb0f93cSkardel		- short packet received
83*abb0f93cSkardel		- bad packet
84*abb0f93cSkardel		- error on open for logfile
85*abb0f93cSkardel
86*abb0f93cSkardelntploopwatch:
87*abb0f93cSkardel	perl script to display loop filter statistics collected by ntploopstat
88*abb0f93cSkardel	or dumped directly by xntpd.
89*abb0f93cSkardel
90*abb0f93cSkardel	Gnuplot is used to produce a graphical representation of the sample
91*abb0f93cSkardel	values, that have been preprocessed and analysed by this script.
92*abb0f93cSkardel
93*abb0f93cSkardel	It can either be called to produce a printout of specific data set or
94*abb0f93cSkardel	used to continously monitor the values. Monitoring is achieved by
95*abb0f93cSkardel	periodically reprocessing the logfiles, which are updated regularly
96*abb0f93cSkardel	either by a running ntploopstat process or by the running xntpd.
97*abb0f93cSkardel
98*abb0f93cSkardel	usage:
99*abb0f93cSkardel	  to watch statistics permanently:
100*abb0f93cSkardel	     ntploopwatch [-v[<level>]] [-c <config-file>] [-d <working-dir>]
101*abb0f93cSkardel
102*abb0f93cSkardel	  to get a single print out specify also
103*abb0f93cSkardel			  -P<printer> [-s<samples>]
104*abb0f93cSkardel				      [-S <start-time>] [-E <end-time>]
105*abb0f93cSkardel				      [-O <MaxOffs>] [-o <MinOffs>]
106*abb0f93cSkardel
107*abb0f93cSkardel	level:		level of verbosity for debugging
108*abb0f93cSkardel	config-file:	file to read configurable settings from
109*abb0f93cSkardel			On each iteration it is checked and reread
110*abb0f93cSkardel			if it has been changed
111*abb0f93cSkardel			default: loopwatch.config
112*abb0f93cSkardel	working-dir:	specify working directory for process, affects
113*abb0f93cSkardel			interpretation of relative file names
114*abb0f93cSkardel
115*abb0f93cSkardel	All other flags are only useful with printing plots, as otherwise
116*abb0f93cSkardel	command line values would be replaced by settings from the config file.
117*abb0f93cSkardel
118*abb0f93cSkardel	printer:	specify printer to print plot
119*abb0f93cSkardel			BSD print systems semantics apply; if printer
120*abb0f93cSkardel			is omitted the name "ps" is used; plots are
121*abb0f93cSkardel			prepared using PostScript, thus the printer
122*abb0f93cSkardel			should best accept postscript input
123*abb0f93cSkardel
124*abb0f93cSkardel	For the following see also the comments in loopwatch.config.SAMPLE
125*abb0f93cSkardel
126*abb0f93cSkardel	samples:	use last # samples from input data
127*abb0f93cSkardel	start-time:	ignore input samples before this date
128*abb0f93cSkardel	end-time:	ignore input samples after this date
129*abb0f93cSkardel			if both start-time and end-time are specified
130*abb0f93cSkardel			a given samples value is ignored
131*abb0f93cSkardel	MaxOffs:
132*abb0f93cSkardel	MinOffs:	restrict value range
133*abb0f93cSkardel
134*abb0f93cSkardelloopwatch.config.SAMPLE:
135*abb0f93cSkardel	sample config file for ntploopwatch
136*abb0f93cSkardel	each configurable option is explained there
137*abb0f93cSkardel
138*abb0f93cSkardellr.pl:
139*abb0f93cSkardel	linear regression package used by ntploopwatch to compute
140*abb0f93cSkardel	linear approximations for frequency and offset values
141*abb0f93cSkardel	within display range
142*abb0f93cSkardel
143*abb0f93cSkardeltimelocal.pl:
144*abb0f93cSkardel
145*abb0f93cSkardel	used during conversion of ISO_DATE_TIME values specified in
146*abb0f93cSkardel	loopwatch config files to unix epoch values (seconds since
147*abb0f93cSkardel	1970-01-01_00:00_00 UTC)
148*abb0f93cSkardel
149*abb0f93cSkardel	A version of this file is distributed with perl-4.x, however,
150*abb0f93cSkardel	it has a bug related to dates crossing 1970, causing endless loops..
151*abb0f93cSkardel	The version contained here has been fixed.
152*abb0f93cSkardel
153*abb0f93cSkardelntp.pl:
154*abb0f93cSkardel	perl support for ntp v2 mode 6 message handling
155*abb0f93cSkardel	WARNING: This code is beta level - it triggers a memory leak;
156*abb0f93cSkardel		 as for now it is not quite clear, wether this is caused by a
157*abb0f93cSkardel		 bug in perl or by bad usage of perl within this script.
158*abb0f93cSkardel
159