1168404SpjdThis directory contains support for monitoring the local clock of xntp daemons.
2168404Spjd
3168404SpjdWARNING: The scripts and routines contained in this directory are beta
4168404Spjd	 release!  Do not depend on their correct operation. They are,
5168404Spjd	 however, in regular use at University of Erlangen-Nuernberg.
6168404Spjd	 No severe problems are known for this code.
7168404Spjd
8168404Spjd!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9168404SpjdPLEASE THINK TWICE BEFORE STARTING MONITORING REMOTE XNTP DEAMONS !!!!
10168404SpjdMONITORING MAY INCREASE THE LOAD OF THE DEAMON MONITORED AND MAY
11168404SpjdINCREASE THE NETWORK LOAD SIGNIFICANTLY
12168404Spjd!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13168404Spjd
14168404Spjd
15168404SpjdFiles are:
16168404Spjd
17168404SpjdREADME:
18168404Spjd	This file
19168404Spjd
20168404Spjdntptrap:
21168404Spjd	perl script to log ntp mode 6 trap messages.
22209962Smm
23168404Spjd	It sends a set_trap request to each server given and dumps the
24168404Spjd	trap messages received. It handles refresh of set_trap.
25168404Spjd	Currently it handles only NTP V2, however the NTP V3 servers
26247265Smm	also accept v2 requests. It will not interpret v3 system and
27269418Sdelphij	peer stati correctly.
28247265Smm
29247265Smm	usage:
30168404Spjd	  ntptrap [-n] [-p <port>] [-l <debug-output>] servers...
31168404Spjd	
32260763Savg	-n:		do not send set_trap requests
33168404Spjd
34168404Spjd	port:		port to listen for responses
35260763Savg			useful if you have a configured trap
36168404Spjd
37168404Spjd	debug-output:	file to write trace output to (for debugging)
38260763Savg
39260763Savg	This script convinced me that ntp trap messages are only of
40260763Savg	little use.
41260763Savg
42260763Savgntploopstat:
43270312Ssmh	perl script to gather loop info statistics from xntpd via mode 7
44260763Savg	LOOP_INFO requests.
45270312Ssmh
46260763Savg	This script collects data to allow monitoring of remote xntp servers
47260763Savg	where it is not possible to directly access the loopstats file
48260763Savg	produced by xntpd itself. Of course, it can be used to sample
49260763Savg	a local server if it is not configured to produce a loopstats file.
50260763Savg
51260763Savg	Please note, this program poses a high load on the server as
52260763Savg	a communication takes place every delay seconds ! USE WITH CARE !
53260763Savg
54260763Savg	usage:
55260763Savg	  ntploopstat [-d<delay>] [-t<timeout>] [-l <logfile>] [-v] [ntpserver]
56260763Savg	
57260763Savg	delay:		number of seconds to wait between samples
58260763Savg			default: 60 seconds
59260763Savg	timeout:	number of seconds to wait for reply
60260763Savg			default 12 seconds
61260763Savg	logfile:	file to log samples to
62260763Savg			default: loopstats:<ntpserver>:
63260763Savg			(note the trailing colon)
64270312Ssmh			This name actually is a prefix.
65260763Savg			The file name is dynamically derived by appending
66260763Savg			the name of the month the sample belongs to.
67260763Savg			Thus all samples of a month end up in the same file.
68260763Savg
69260763Savg	the format of the files generated is identical to the format used by
70260763Savg	xntpd with the loopstats file:
71260763Savg		MJD <seconds since midnight UTC> offset frequency compliance
72260763Savg	
73270312Ssmh	if a timeout occurs the next sample is tried after delay/2 seconds
74260763Savg
75260763Savg	The script will terminate after MAX_FAIL (currently 60)
76260763Savg	consecutive errors.
77260763Savg
78260763Savg	Errors are counted for:
79260763Savg		- error on send call
80260763Savg		- error on select call
81260763Savg		- error on recv call
82260763Savg		- short packet received
83260763Savg		- bad packet 
84260763Savg		- error on open for logfile
85260763Savg
86260763Savgntploopwatch:
87260763Savg	perl script to display loop filter statistics collected by ntploopstat
88260763Savg	or dumped directly by xntpd.
89260763Savg
90260763Savg	Gnuplot is used to produce a graphical representation of the sample
91260763Savg	values, that have been preprocessed and analysed by this script.
92260763Savg
93260763Savg	It can either be called to produce a printout of specific data set or
94260763Savg	used to continously monitor the values. Monitoring is achieved by 
95260763Savg	periodically reprocessing the logfiles, which are updated regularly
96260763Savg	either by a running ntploopstat process or by the running xntpd.
97260763Savg
98260763Savg	usage:
99260763Savg	  to watch statistics permanently:
100260763Savg	     ntploopwatch [-v[<level>]] [-c <config-file>] [-d <working-dir>]
101260763Savg
102260763Savg	  to get a single print out specify also
103260763Savg			  -P<printer> [-s<samples>]
104260763Savg				      [-S <start-time>] [-E <end-time>]
105260763Savg				      [-O <MaxOffs>] [-o <MinOffs>]
106260763Savg	
107260763Savg	level:		level of verbosity for debugging
108260763Savg	config-file:	file to read configurable settings from
109260763Savg			On each iteration it is checked and reread
110260763Savg			if it has been changed
111260763Savg			default: loopwatch.config
112260763Savg	working-dir:	specify working directory for process, affects
113168404Spjd			interpretation of relative file names
114251631Sdelphij	
115260763Savg	All other flags are only useful with printing plots, as otherwise
116270312Ssmh	command line values would be replaced by settings from the config file.
117260763Savg
118260763Savg	printer:	specify printer to print plot
119260763Savg			BSD print systems semantics apply; if printer
120260763Savg			is omitted the name "ps" is used; plots are
121251631Sdelphij			prepared using PostScript, thus the printer
122168404Spjd			should best accept postscript input
123270312Ssmh
124260763Savg	For the following see also the comments in loopwatch.config.SAMPLE
125260763Savg
126260763Savg	samples:	use last # samples from input data
127260763Savg	start-time:	ignore input samples before this date
128260763Savg	end-time:	ignore input samples after this date
129260763Savg			if both start-time and end-time are specified
130260763Savg			a given samples value is ignored
131260763Savg	MaxOffs:
132260763Savg	MinOffs:	restrict value range 
133260763Savg
134260763Savgloopwatch.config.SAMPLE:
135260763Savg	sample config file for ntploopwatch
136260763Savg	each configurable option is explained there
137168404Spjd
138260763Savglr.pl:
139260763Savg	linear regression package used by ntploopwatch to compute
140260763Savg	linear approximations for frequency and offset values
141260763Savg	within display range
142260763Savg
143260763Savgtimelocal.pl:
144260763Savg
145260763Savg	used during conversion of ISO_DATE_TIME values specified in
146260763Savg	loopwatch config files to unix epoch values (seconds since
147260763Savg	1970-01-01_00:00_00 UTC)
148270312Ssmh
149270312Ssmh	A version of this file is distributed with perl-4.x, however,
150270312Ssmh	it has a bug related to dates crossing 1970, causing endless loops..
151270312Ssmh	The version contained here has been fixed.
152270312Ssmh
153270312Ssmhntp.pl:
154270312Ssmh	perl support for ntp v2 mode 6 message handling
155168404Spjd	WARNING: This code is beta level - it triggers a memory leak;
156270312Ssmh		 as for now it is not quite clear, wether this is caused by a
157249206Smm		 bug in perl or by bad usage of perl within this script.
158260763Savg
159260763Savg