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