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