154359SrobertoThis directory contains support for monitoring the local clock of xntp daemons. 254359Sroberto 382498SrobertoWARNING: The scripts and routines contained in this directory are beta 482498Sroberto release! Do not depend on their correct operation. They are, 582498Sroberto however, in regular use at University of Erlangen-Nuernberg. 682498Sroberto No severe problems are known for this code. 754359Sroberto 854359Sroberto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 954359SrobertoPLEASE THINK TWICE BEFORE STARTING MONITORING REMOTE XNTP DEAMONS !!!! 1054359SrobertoMONITORING MAY INCREASE THE LOAD OF THE DEAMON MONITORED AND MAY 1182498SrobertoINCREASE THE NETWORK LOAD SIGNIFICANTLY 1254359Sroberto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1354359Sroberto 1454359Sroberto 1554359SrobertoFiles are: 1654359Sroberto 1754359SrobertoREADME: 1854359Sroberto This file 1954359Sroberto 2054359Srobertontptrap: 2154359Sroberto perl script to log ntp mode 6 trap messages. 2254359Sroberto 2354359Sroberto It sends a set_trap request to each server given and dumps the 2454359Sroberto trap messages received. It handles refresh of set_trap. 2554359Sroberto Currently it handles only NTP V2, however the NTP V3 servers 2682498Sroberto also accept v2 requests. It will not interpret v3 system and 2782498Sroberto peer stati correctly. 2854359Sroberto 2954359Sroberto usage: 3054359Sroberto ntptrap [-n] [-p <port>] [-l <debug-output>] servers... 3154359Sroberto 3254359Sroberto -n: do not send set_trap requests 3354359Sroberto 3454359Sroberto port: port to listen for responses 3554359Sroberto useful if you have a configured trap 3654359Sroberto 3754359Sroberto debug-output: file to write trace output to (for debugging) 3854359Sroberto 3954359Sroberto This script convinced me that ntp trap messages are only of 4054359Sroberto little use. 4154359Sroberto 4254359Srobertontploopstat: 4354359Sroberto perl script to gather loop info statistics from xntpd via mode 7 4454359Sroberto LOOP_INFO requests. 4554359Sroberto 4654359Sroberto This script collects data to allow monitoring of remote xntp servers 4754359Sroberto where it is not possible to directly access the loopstats file 4854359Sroberto produced by xntpd itself. Of course, it can be used to sample 4954359Sroberto a local server if it is not configured to produce a loopstats file. 5054359Sroberto 5154359Sroberto Please note, this program poses a high load on the server as 5254359Sroberto a communication takes place every delay seconds ! USE WITH CARE ! 5354359Sroberto 5454359Sroberto usage: 5554359Sroberto ntploopstat [-d<delay>] [-t<timeout>] [-l <logfile>] [-v] [ntpserver] 5654359Sroberto 5754359Sroberto delay: number of seconds to wait between samples 5854359Sroberto default: 60 seconds 5954359Sroberto timeout: number of seconds to wait for reply 6054359Sroberto default 12 seconds 6154359Sroberto logfile: file to log samples to 6254359Sroberto default: loopstats:<ntpserver>: 6354359Sroberto (note the trailing colon) 6454359Sroberto This name actually is a prefix. 6554359Sroberto The file name is dynamically derived by appending 6654359Sroberto the name of the month the sample belongs to. 6754359Sroberto Thus all samples of a month end up in the same file. 6854359Sroberto 6954359Sroberto the format of the files generated is identical to the format used by 7054359Sroberto xntpd with the loopstats file: 7154359Sroberto MJD <seconds since midnight UTC> offset frequency compliance 7254359Sroberto 7354359Sroberto if a timeout occurs the next sample is tried after delay/2 seconds 7454359Sroberto 7582498Sroberto The script will terminate after MAX_FAIL (currently 60) 7682498Sroberto consecutive errors. 7782498Sroberto 7854359Sroberto Errors are counted for: 7954359Sroberto - error on send call 8054359Sroberto - error on select call 8154359Sroberto - error on recv call 8254359Sroberto - short packet received 8354359Sroberto - bad packet 8454359Sroberto - error on open for logfile 8554359Sroberto 8654359Srobertontploopwatch: 8754359Sroberto perl script to display loop filter statistics collected by ntploopstat 8854359Sroberto or dumped directly by xntpd. 8954359Sroberto 9054359Sroberto Gnuplot is used to produce a graphical representation of the sample 9154359Sroberto values, that have been preprocessed and analysed by this script. 9254359Sroberto 9354359Sroberto It can either be called to produce a printout of specific data set or 9454359Sroberto used to continously monitor the values. Monitoring is achieved by 9554359Sroberto periodically reprocessing the logfiles, which are updated regularly 9654359Sroberto either by a running ntploopstat process or by the running xntpd. 9754359Sroberto 9854359Sroberto usage: 9954359Sroberto to watch statistics permanently: 10054359Sroberto ntploopwatch [-v[<level>]] [-c <config-file>] [-d <working-dir>] 10154359Sroberto 10254359Sroberto to get a single print out specify also 10354359Sroberto -P<printer> [-s<samples>] 10454359Sroberto [-S <start-time>] [-E <end-time>] 10554359Sroberto [-O <MaxOffs>] [-o <MinOffs>] 10654359Sroberto 10754359Sroberto level: level of verbosity for debugging 10854359Sroberto config-file: file to read configurable settings from 10954359Sroberto On each iteration it is checked and reread 11054359Sroberto if it has been changed 11154359Sroberto default: loopwatch.config 11254359Sroberto working-dir: specify working directory for process, affects 11354359Sroberto interpretation of relative file names 11454359Sroberto 11554359Sroberto All other flags are only useful with printing plots, as otherwise 11654359Sroberto command line values would be replaced by settings from the config file. 11754359Sroberto 11854359Sroberto printer: specify printer to print plot 11982498Sroberto BSD print systems semantics apply; if printer 12082498Sroberto is omitted the name "ps" is used; plots are 12182498Sroberto prepared using PostScript, thus the printer 12282498Sroberto should best accept postscript input 12354359Sroberto 12454359Sroberto For the following see also the comments in loopwatch.config.SAMPLE 12554359Sroberto 12654359Sroberto samples: use last # samples from input data 12754359Sroberto start-time: ignore input samples before this date 12854359Sroberto end-time: ignore input samples after this date 12954359Sroberto if both start-time and end-time are specified 13054359Sroberto a given samples value is ignored 13154359Sroberto MaxOffs: 13254359Sroberto MinOffs: restrict value range 13354359Sroberto 13454359Srobertoloopwatch.config.SAMPLE: 13554359Sroberto sample config file for ntploopwatch 13654359Sroberto each configurable option is explained there 13754359Sroberto 13854359Srobertolr.pl: 13954359Sroberto linear regression package used by ntploopwatch to compute 14054359Sroberto linear approximations for frequency and offset values 14154359Sroberto within display range 14254359Sroberto 14354359Srobertotimelocal.pl: 14454359Sroberto 14582498Sroberto used during conversion of ISO_DATE_TIME values specified in 14682498Sroberto loopwatch config files to unix epoch values (seconds since 14782498Sroberto 1970-01-01_00:00_00 UTC) 14882498Sroberto 14954359Sroberto A version of this file is distributed with perl-4.x, however, 15054359Sroberto it has a bug related to dates crossing 1970, causing endless loops.. 15154359Sroberto The version contained here has been fixed. 15254359Sroberto 15354359Srobertontp.pl: 15454359Sroberto perl support for ntp v2 mode 6 message handling 15554359Sroberto WARNING: This code is beta level - it triggers a memory leak; 15654359Sroberto as for now it is not quite clear, wether this is caused by a 15754359Sroberto bug in perl or by bad usage of perl within this script. 15854359Sroberto 159