xref: /freebsd/contrib/ntp/html/monopt.html (revision 123af6ec70016f5556da5972d4d63c7d175c06d3)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
5<meta name="generator" content="HTML Tidy, see www.w3.org">
6<title>Monitoring Options</title>
7<link href="scripts/style.css" type="text/css" rel="stylesheet">
8</head>
9<body>
10<h3>Monitoring Commands and Options</h3>
11<img src="pic/pogo8.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html"></a> from <i>Pogo</i>, Walt Kelly</a>
12<p>Pig was hired to watch the logs.</p>
13<p>Last update:
14  <!-- #BeginDate format:En2m -->7-Dec-2017  10:17<!-- #EndDate -->
15    UTC</p>
16<br clear="left">
17<h4>Related Links</h4>
18<script type="text/javascript" language="javascript" src="scripts/command.txt"></script>
19<script type="text/javascript" language="javascript" src="scripts/monopt.txt"></script>
20<h4>Table of Contents</h4>
21<ul>
22  <li class="inline"><a href="#intro">Naming Conventions</a></li>
23  <li class="inline"><a href="#cmd">Monitoring Commands and Options</a></li>
24  <li class="inline"><a href="#types">File Set Types</a></li>
25</ul>
26<hr>
27<h4 id="intro">Naming Conventions</h4>
28<p>The <tt>ntpd</tt> includes a comprehensive monitoring facility which collects
29  statistical data of various types and writes the data to files associated with
30  each type at defined events or intervals. The files associated with a particular
31  type are collectively called the generation file set for that type. The files
32  in the file set are the members of that set.</p>
33<p>File sets have names specific to the type and generation epoch. The names
34  are constructed from three concatenated elements <i><tt>prefix</tt></i>, <i><tt>filename</tt></i> and <i><tt>suffix</tt></i>:</p>
35<dl>
36  <dt><i><tt>prefix</tt></i></dt>
37  <dd>The directory path specified in the <tt>statsdir</tt> command.</dd>
38  <dt><i><tt>name</tt></i></dt>
39  <dd>The name specified by the <tt>file</tt> option of the <tt>filegen</tt> command.</dd>
40  <dt><i><tt>suffix</tt></i></dt>
41  <dd>A string of elements bdginning with . (dot) followed by a number of elements
42    depending on the file set type.</dd>
43</dl>
44<p>Statistics files can be managed using scripts, examples of which are in the <tt>./scripts</tt> directory.
45  Using these or similar scripts and Unix <tt>cron</tt> jobs, the files can be
46  automatically summarized and archived for retrospective analysis.</p>
47<h4 id="cmd">Monitoring Commands and Options</h4>
48<p>Unless noted otherwise, further information about these commands is on the <a href="decode.html">Event Messages and Status Codes</a> page.</p></a> page.</p><dl>
49  <dt id="filegen"><tt>filegen <i>name</i> [file <i>filename</i>] [type <i>type</i>]
50    [link | nolink] [enable | disable]</tt></dt>
51  <dd>
52    <dl>
53      <dt><i><tt>name</tt></i></dt>
54      <dd>Specifies the file set type from the list in the next section.</dd>
55      <dt><tt>file <i>filename</i></tt></dt>
56      <dd>Specifies the filename prefix. The default is the file set type, such as "loopstats".</dd>
57      <dt><tt>type <i>typename</i></tt></dt>
58      <dd>Specifies the file set interval. The following intervals are supported
59        with default <tt>day</tt>:</dd>
60      <dd>
61        <dl>
62          <dt><tt>none</tt></dt>
63          <dd>The file set is actually a single plain file.</dd>
64          <dt><tt>pid</tt></dt>
65          <dd>One file set member is created for every incarnation of <tt>ntpd</tt>.
66            The file name suffix is the string .<tt>n</tt>, where <tt>n</tt> is the
67            process ID of the <tt>ntpd</tt> server process.</dd>
68          <dt><tt>day</tt></dt>
69          <dd>One file set member is created per day. A day is defined as the period
70            between 00:00 and 23:59 UTC. The file name suffix is the string .<tt>yyyymmdd</tt>,
71            where <tt>yyyy</tt> is the year, <tt>mm</tt> the month of the year and <tt>dd</tt> the
72            day of the month. Thus, member created on 10 December 1992 would have suffix <tt>.19921210</tt>.</dd>
73          <dt><tt>week</tt></dt>
74          <dd>One file set member is created per week. The week is defined as the
75            day of year modulo 7. The file name suffix is the string .<tt>yyyyWww</tt>,
76            where <tt>yyyy</tt> is the year, <tt>W</tt> stands for itself and <tt>ww</tt> the
77            week number starting from 0. For example, The member created on 10 January
78            1992 would have suffix <tt>.1992W1</tt>.</dd>
79          <dt><tt>month</tt></dt>
80          <dd>One file set member is created per month. The file name suffix is the
81            string .<tt>yyyymm</tt>, where <tt>yyyy</tt> is the year and <tt>mm</tt> the
82            month of the year starting from 1. For example, The member created on 10
83            January 1992 would have suffix <tt>.199201</tt>.</dd>
84          <dt><tt>year</tt></dt>
85          <dd>One file set member is generated per year. The file name suffix is the
86            string .<tt>yyyy</tt>, where <tt>yyyy</tt> is the year. For example, The
87            member created on 1 January 1992 would have suffix <tt>.1992</tt>.</dd>
88          <dt><tt>age</tt></dt>
89          <dd>One file set member is generated every 24 hours of <tt>ntpd</tt> operation.
90            The filename suffix is the string <tt>.adddddddd</tt>, where <tt>a</tt> stands
91            for itself and <tt>dddddddd</tt> is the <tt>ntpd</tt> running time in seconds
92            at the start of the corresponding 24-hour period.</dd>
93        </dl>
94      </dd>
95      <dt><tt>link | nolink</tt></dt>
96      <dd>It is convenient to be able to access the current file set members by
97        file name, but without the suffix. This feature is enabled by <tt>link</tt> and
98        disabled by <tt>nolink</tt>. If enabled, which is the default, a hard link
99        from the current file set member to a file without suffix is created. When
100        there is already a file with this name and the number of links to this file
101        is one, it is renamed by appending a dot, the letter <tt>C</tt>, and the
102        pid of the <tt>ntpd</tt> server process. When the number of links is greater
103        than one, the file is unlinked. This allows the current file to be accessed
104        by a constant name.</dd>
105      <dt><tt>enable | disable</tt></dt>
106      <dd>Enable or disable the recording function, with default <tt>enable</tt>.
107        These options are intended for remote configuration commands.</dd>
108    </dl>
109  </dd>
110  <dt id="statistics"><tt>statistics <i>name</i>...</tt></dt>
111  <dd>Enables writing of statistics records. Currently, eight kinds of
112    statistics are supported: <i>name</i>s specify the file set type(s) from
113    the list in the next section.</dd>
114  <dt id="statsdir"><tt>statsdir <i>directory_path</i></tt></dt>
115  <dd>Specify the directory path prefix for statistics file names.</dd>
116</dl>
117<h4 id="types">File Set Types</h4>
118<dl>
119  <dt><tt>clockstats</tt></dt>
120  <dd>Record reference clock statistics. Each update received from a reference
121    clock driver appends one line to the <tt>clockstats</tt> file set:</dd>
122  <dd><tt>49213 525.624 127.127.4.1 93 226 00:08:29.606 D</tt></dd>
123  <dd>
124    <table width="100%" border="1" cellspacing="2" cellpadding="2">
125      <tr>
126        <td>Item</td>
127        <td>Units</td>
128        <td>Description</td>
129      </tr>
130      <tr>
131        <td><tt>49213</tt></td>
132        <td>MJD</td>
133        <td>date</td>
134      </tr>
135      <tr>
136        <td><tt>525.624</tt></td>
137        <td>s</td>
138        <td>time past midnight</td>
139      </tr>
140      <tr>
141        <td><tt>127.127.4.1</tt></td>
142        <td>IP</td>
143        <td>reference clock address</td>
144      </tr>
145      <tr>
146        <td><tt><i>message</i></tt></td>
147        <td>text</td>
148        <td>log message</td>
149      </tr>
150    </table>
151  </dd>
152  <dd>The <tt><i>message</i></tt> field includes the last timecode received in
153    decoded ASCII format, where meaningful. In some cases a good deal of additional
154    information is displayed. See information specific to each reference clock
155    for further details.</dd>
156  <dt><tt>cryptostats</tt></dt>
157  <dd>Record significant events in the Autokey protocol. This option requires
158    the OpenSSL cryptographic software library. Each event appends one line to
159    the <tt>cryptostats</tt> file set:</dd>
160  <dd><tt>49213 525.624 128.4.1.1 <i>message</i></tt></dd>
161  <dd>
162    <table width="100%" border="1" cellspacing="2" cellpadding="2">
163      <tr>
164        <td>Item</td>
165        <td>Units</td>
166        <td>Description</td>
167      </tr>
168      <tr>
169        <td><tt>49213</tt></td>
170        <td>MJD</td>
171        <td>date</td>
172      </tr>
173      <tr>
174        <td><tt>525.624</tt></td>
175        <td>s</td>
176        <td>time past midnight</td>
177      </tr>
178      <tr>
179        <td><tt>128.4.1.1</tt></td>
180        <td>IP</td>
181        <td>source address (<tt>0.0.0.0</tt> for system)</td>
182      </tr>
183      <tr>
184        <td><tt><i>message</i></tt></td>
185        <td>text</td>
186        <td>log message</td>
187      </tr>
188    </table>
189  </dd>
190  <dd>The <tt><i>message</i></tt> field includes the message type and certain
191    ancillary information. See the <a href="authopt.html">Authentication Options</a> page
192    for further information.</dd>
193  <dt><tt>loopstats</tt></dt>
194  <dd>Record clock discipline loop statistics. Each system clock update appends
195    one line to the <tt>loopstats</tt> file set:</dd>
196  <dd><tt>50935 75440.031 0.000006019 13.778 0.000351733 0.013380 6</tt></dd>
197  <dd>
198    <table width="100%" border="1" cellspacing="2" cellpadding="2">
199      <tr>
200        <td>Item</td>
201        <td>Units</td>
202        <td>Description</td>
203      </tr>
204      <tr>
205        <td><tt>50935</tt></td>
206        <td>MJD</td>
207        <td>date</td>
208      </tr>
209      <tr>
210        <td><tt>75440.031</tt></td>
211        <td>s</td>
212        <td>time past midnight</td>
213      </tr>
214      <tr>
215        <td><tt>0.000006019</tt></td>
216        <td>s</td>
217        <td>clock offset</td>
218      </tr>
219      <tr>
220        <td><tt>13.778</tt></td>
221        <td>PPM</td>
222        <td>frequency offset</td>
223      </tr>
224      <tr>
225        <td><tt>0.000351733</tt></td>
226        <td>s</td>
227        <td>RMS jitter</td>
228      </tr>
229      <tr>
230        <td><tt>0.013380</tt></td>
231        <td>PPM</td>
232        <td>RMS&nbsp;frequency jitter (aka wander)</td>
233      </tr>
234      <tr>
235        <td><tt>6 </tt></td>
236        <td>log<sub>2</sub> s</td>
237        <td>clock discipline loop time constant</td>
238      </tr>
239    </table>
240  </dd>
241  <dt><tt>peerstats</tt></dt>
242  <dd>Record peer statistics. Each NTP packet or reference clock update received
243    appends one line to the <tt>peerstats</tt> file set:</dd>
244  <dd><tt>48773 10847.650 127.127.4.1 9714 -0.001605376 0.000000000 0.001424877
245    0.000958674</tt></dd>
246  <dd>
247    <table width="100%" border="1" cellspacing="2" cellpadding="2">
248      <tr>
249        <td>Item</td>
250        <td>Units</td>
251        <td>Description</td>
252      </tr>
253      <tr>
254        <td><tt>48773</tt></td>
255        <td>MJD</td>
256        <td>date</td>
257      </tr>
258      <tr>
259        <td><tt>10847.650</tt></td>
260        <td>s</td>
261        <td>time past midnight</td>
262      </tr>
263      <tr>
264        <td><tt>127.127.4.1</tt></td>
265        <td>IP</td>
266        <td>source address</td>
267      </tr>
268      <tr>
269        <td><tt>9714</tt></td>
270        <td>hex</td>
271        <td>status word</td>
272      </tr>
273      <tr>
274        <td><tt>-0.001605376</tt></td>
275        <td>s</td>
276        <td>clock offset</td>
277      </tr>
278      <tr>
279        <td><tt>0.000000000 </tt></td>
280        <td>s</td>
281        <td>roundtrip delay</td>
282      </tr>
283      <tr>
284        <td><tt>0.001424877</tt></td>
285        <td>s</td>
286        <td>dispersion</td>
287      </tr>
288      <tr>
289        <td><tt>0.000958674</tt></td>
290        <td>s</td>
291        <td>RMS&nbsp;jitter</td>
292      </tr>
293    </table>
294  </dd>
295  <dd>The status field is encoded in hex format as described in Appendix B of
296    the NTP specification RFC 1305.</dd>
297  <dt><tt>protostats</tt></dt>
298  <dd>Record significant peer, system and protocol events. Each significant event
299    appends one line to the <tt>protostats</tt> file set:</dd>
300  <dd><tt>49213 525.624 128.4.1.1 963a 8a <i>message</i></tt></dd>
301  <dd>
302    <table width="100%" border="1" cellspacing="2" cellpadding="2">
303      <tr>
304        <td>Item</td>
305        <td>Units</td>
306        <td>Description</td>
307      </tr>
308      <tr>
309        <td><tt>49213</tt></td>
310        <td>MJD</td>
311        <td>date</td>
312      </tr>
313      <tr>
314        <td><tt>525.624</tt></td>
315        <td>s</td>
316        <td>time past midnight</td>
317      </tr>
318      <tr>
319        <td><tt>128.4.1.1</tt></td>
320        <td>IP</td>
321        <td>source address (<tt>0.0.0.0</tt> for system)</td>
322      </tr>
323      <tr>
324        <td><tt>963a</tt></td>
325        <td>code</td>
326        <td>status word</td>
327      </tr>
328      <tr>
329        <td><tt>8a</tt></td>
330        <td>code</td>
331        <td>event message code</td>
332      </tr>
333      <tr>
334        <td><tt><i>message</i></tt></td>
335        <td>text</td>
336        <td>event message</td>
337      </tr>
338    </table>
339  </dd>
340  <dd>The event message code and <tt><i>message</i></tt> field are described on
341    the <a href="decode.html">Event Messages and Status Words</a> page.</dd>
342  <dt><tt>rawstats</tt></dt>
343  <dd>Record timestamp statistics. Each NTP packet received appends one line to
344the <tt>rawstats</tt> file set.  As of ntp-4.2.8p11, each NTP packet written appends one line to the <tt>rawstats</tt> file set, as well.  The format of this line is:</dd>
345  <dd><tt>56285 54575.160 128.4.1.1 192.168.1.5 3565350574.400229473 3565350574.442385200 3565350574.442436000 3565350575.154505763 0 4 4 1 8 -21 0.000000 0.000320 .PPS.</tt></dd>
346  <dd><tt>56285 54575.160 128.4.1.1 192.168.1.5 3565350574.400229473 3565350574.442385200 3565350574.442436000 3565350575.154505763 0 4 4 1 8 -21 0.000000 0.000320 .PPS. 4: 0000</tt></dd>
347  </tt></dd>
348  <dd>
349    <table width="100%" border="1" cellspacing="2" cellpadding="2">
350      <tr>
351        <td>Item</td>
352        <td>Units</td>
353        <td>Description</td>
354      </tr>
355      <tr>
356        <td><tt>56285</tt></td>
357        <td>MJD</td>
358        <td>date</td>
359      </tr>
360      <tr>
361        <td><tt>54575.160</tt></td>
362        <td>s</td>
363        <td>time past midnight</td>
364      </tr>
365      <tr>
366        <td><tt>128.4.1.1</tt></td>
367        <td>IP</td>
368        <td>source address</td>
369      </tr>
370      <tr>
371        <td><tt>192.168.1.5</tt></td>
372        <td>IP</td>
373        <td>destination address</td>
374      </tr>
375      <tr>
376        <td><tt>3565350574.400229473</tt></td>
377        <td>NTP&nbsp;s</td>
378        <td>origin timestamp</td>
379      </tr>
380      <tr>
381        <td><tt>3565350574.442385200</tt></td>
382        <td>NTP s</td>
383        <td>receive timestamp</td>
384      </tr>
385      <tr>
386        <td><tt>3565350574.442436000</tt></td>
387        <td>NTP s</td>
388        <td>transmit timestamp</td>
389      </tr>
390      <tr>
391        <td><tt>3565350575.154505763</tt></td>
392        <td>NTP&nbsp;s</td>
393        <td>destination timestamp</td>
394      </tr>
395      <tr>
396        <td><tt>0</tt></td>
397        <td>0: OK, 1: insert pending,<br>2: delete pending, 3: not synced</td>
398        <td>leap warning indicator</td>
399      </tr>
400      <tr>
401        <td><tt>4</tt></td>
402        <td>4 was current in 2012</td>
403        <td>NTP version</td>
404      </tr>
405      <tr>
406        <td><tt>4</tt></td>
407        <td>3: client, 4: server, 5: broadcast</td>
408        <td>mode</td>
409      </tr>
410      <tr>
411        <td><tt>1</tt></td>
412        <td>1-15, 16: not synced</td>
413        <td>stratum</td>
414      </tr>
415      <tr>
416        <td><tt>8</tt></td>
417        <td>log<sub>2</sub> seconds</td>
418        <td>poll</td>
419      </tr>
420      <tr>
421        <td><tt>-21</tt></td>
422        <td>log<sub>2</sub> seconds</td>
423        <td>precision</td>
424      </tr>
425      <tr>
426        <td><tt>0.000000</tt></td>
427        <td>seconds</td>
428        <td>total roundtrip delay to the primary reference clock</td>
429      </tr>
430      <tr>
431        <td><tt>0.000320</tt></td>
432        <td>seconds</td>
433        <td>total dispersion to the primary reference clock</td>
434      </tr>
435      <tr>
436        <td><tt>.PPS.</tt></td>
437        <td>REFID</td>
438        <td>system peer, association ID</td>
439      </tr>
440      <tr>
441	<td></td>
442	<td></td>
443        <td>If there is data beyond the base packet:</td>
444      </tr>
445      <tr>
446        <td><tt>4:</tt></td>
447        <td>Integer</td>
448        <td>Length, in bytes</td>
449      </tr>
450      <tr>
451        <td><tt>0000</tt></td>
452        <td>Hex data</td>
453      </tr>
454    </table>
455  </dd>
456  <dt><tt>sysstats</tt></dt>
457  <dd>Record system statistics. Each hour one line is appended to the <tt>sysstats</tt> file
458    set in the following format:</dd>
459  <dd><tt>50928 2132.543 3600 81965 0 9546 56 512 540 10 4 147 1</tt></dd>
460  <dd>
461    <table width="100%" border="1" cellspacing="2" cellpadding="2">
462      <tr>
463        <td>Item</td>
464        <td>Units</td>
465        <td>Description</td>
466      </tr>
467      <tr>
468        <td><tt>50928</tt></td>
469        <td>MJD</td>
470        <td>date</td>
471      </tr>
472      <tr>
473        <td><tt>2132.543</tt></td>
474        <td>s</td>
475        <td>time past midnight</td>
476      </tr>
477      <tr>
478        <td><tt>3600</tt></td>
479        <td>s</td>
480        <td>time since reset</td>
481      </tr>
482      <tr>
483        <td><tt>81965</tt></td>
484        <td>#</td>
485        <td>packets received</td>
486      </tr>
487      <tr>
488        <td><tt>0</tt></td>
489        <td>#</td>
490        <td>packets for this host</td>
491      </tr>
492      <tr>
493        <td><tt>9546</tt></td>
494        <td>#</td>
495        <td>current versions</td>
496      </tr>
497      <tr>
498        <td><tt>56</tt></td>
499        <td>#</td>
500        <td>old version</td>
501      </tr>
502      <tr>
503        <td><tt>512</tt></td>
504        <td>#</td>
505        <td>access denied</td>
506      </tr>
507      <tr>
508        <td><tt>540</tt></td>
509        <td>#</td>
510        <td>bad length or format</td>
511      </tr>
512      <tr>
513        <td><tt>10</tt></td>
514        <td>#</td>
515        <td>bad authentication</td>
516      </tr>
517      <tr>
518        <td><tt>4</tt></td>
519        <td>#</td>
520        <td>declined</td>
521      </tr>
522      <tr>
523        <td><tt>147</tt></td>
524        <td>#</td>
525        <td>rate exceeded</td>
526      </tr>
527      <tr>
528        <td><tt>1</tt></td>
529        <td>#</td>
530        <td>kiss-o'-death packets sent</td>
531      </tr>
532    </table>
533  </dd>
534  <dt><tt>timingstats</tt></dt>
535  <dd>(Only available when the daemon is compiled with process time debugging
536    support (--enable-debug-timing - costs performance). Record processing time
537    statistics for various selected code paths.</dd>
538  <dd><tt>53876 36.920 10.0.3.5 1 0.000014592 input processing delay</tt></dd>
539  <dd>
540    <table width="100%" border="1" cellspacing="2" cellpadding="2">
541      <tr>
542        <td>Item</td>
543        <td>Units</td>
544        <td>Description</td>
545      </tr>
546      <tr>
547        <td><tt>53876</tt></td>
548        <td>MJD</td>
549        <td>date</td>
550      </tr>
551      <tr>
552        <td><tt>36.920</tt></td>
553        <td>s</td>
554        <td>time past midnight</td>
555      </tr>
556      <tr>
557        <td><tt>10.0.3.5</tt></td>
558        <td>IP</td>
559        <td>server address</td>
560      </tr>
561      <tr>
562        <td><tt>1</tt></td>
563        <td>#</td>
564        <td>event count</td>
565      </tr>
566      <tr>
567        <td><tt>0.000014592</tt></td>
568        <td>s</td>
569        <td>total time</td>
570      </tr>
571      <tr>
572        <td><tt><i>message</i></tt></td>
573        <td>text</td>
574        <td>code path description (see source)</td>
575      </tr>
576    </table>
577  </dd>
578</dl>
579<hr>
580<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
581</body>
582</html>
583