1181834Sroberto/* -*- Mode: Text -*- */
2181834Sroberto
3181834Srobertoautogen definitions options;
4181834Sroberto
5181834Sroberto#include copyright.def
6181834Sroberto#include homerc.def
7181834Sroberto#include autogen-version.def
8181834Sroberto
9181834Srobertoprog-name      = "ntpq";
10181834Srobertoprog-title     = "standard NTP query program";
11181834Srobertoargument       = '[ host ...]';
12181834Sroberto
13181834Srobertoflag = {
14181834Sroberto    name      = ipv4;
15280849Scy    flags-cant = ipv6;
16181834Sroberto    value     = 4;
17330106Sdelphij    descrip   = "Force IPv4 name resolution";
18181834Sroberto    doc = <<-  _EndOfDoc_
19330106Sdelphij	Force resolution of following host names on the command line
20181834Sroberto	to the IPv4 namespace.
21181834Sroberto	_EndOfDoc_;
22181834Sroberto};
23181834Sroberto
24181834Srobertoflag = {
25181834Sroberto    name      = ipv6;
26280849Scy    flags-cant = ipv4;
27181834Sroberto    value     = 6;
28330106Sdelphij    descrip   = "Force IPv6 name resolution";
29181834Sroberto    doc = <<-  _EndOfDoc_
30330106Sdelphij	Force resolution of following host names on the command line
31181834Sroberto	to the IPv6 namespace.
32181834Sroberto	_EndOfDoc_;
33181834Sroberto};
34181834Sroberto
35181834Srobertoflag = {
36181834Sroberto    name      = command;
37181834Sroberto    value     = c;
38181834Sroberto    arg-type  = string;
39181834Sroberto    descrip   = "run a command and exit";
40181834Sroberto    max       = NOLIMIT;
41181834Sroberto    arg-name  = cmd;
42280849Scy    call-proc = ntpq_custom_opt_handler;
43181834Sroberto    doc = <<-  _EndOfDoc_
44181834Sroberto	The following argument is interpreted as an interactive format command
45181834Sroberto	and is added to the list of commands to be executed on the specified
46181834Sroberto	host(s).
47181834Sroberto	_EndOfDoc_;
48181834Sroberto};
49181834Sroberto
50181834Sroberto#include debug-opt.def
51181834Sroberto
52181834Srobertoflag = {
53181834Sroberto    name      = interactive;
54181834Sroberto    value     = i;
55181834Sroberto    flags-cant = command, peers;
56181834Sroberto    descrip   = "Force ntpq to operate in interactive mode";
57181834Sroberto    doc = <<-  _EndOfDoc_
58280849Scy	Force @code{ntpq} to operate in interactive mode.
59280849Scy	Prompts will be written to the standard output and
60280849Scy	commands read from the standard input.
61181834Sroberto	_EndOfDoc_;
62181834Sroberto};
63181834Sroberto
64181834Srobertoflag = {
65181834Sroberto    name      = numeric;
66181834Sroberto    value     = n;
67181834Sroberto    descrip   = "numeric host addresses";
68181834Sroberto    doc = <<-  _EndOfDoc_
69181834Sroberto	Output all host addresses in dotted-quad numeric format rather than
70330106Sdelphij	converting to the canonical host names.
71181834Sroberto	_EndOfDoc_;
72181834Sroberto};
73181834Sroberto
74280849Scyflag = {
75280849Scy    name      = old-rv;
76280849Scy    descrip   = "Always output status line with readvar";
77280849Scy    doc = <<-  _EndOfDoc_
78280849Scy	By default, @code{ntpq} now suppresses the @code{associd=...}
79280849Scy	line that precedes the output of @code{readvar}
80280849Scy	(alias @code{rv}) when a single variable is requested, such as
81280849Scy	@code{ntpq -c "rv 0 offset"}.
82280849Scy	This option causes @code{ntpq} to include both lines of output
83280849Scy	for a single-variable @code{readvar}.
84280849Scy	Using an environment variable to
85280849Scy	preset this option in a script will enable both older and
86280849Scy	newer @code{ntpq} to behave identically in this regard.
87280849Scy	_EndOfDoc_;
88280849Scy};
89181834Sroberto
90280849Scyflag = {
91280849Scy    name      = peers;
92280849Scy    value     = p;
93280849Scy    descrip   = "Print a list of the peers";
94280849Scy    flags-cant = interactive;
95280849Scy    call-proc = ntpq_custom_opt_handler;
96280849Scy    doc = <<-  _EndOfDoc_
97280849Scy	Print a list of the peers known to the server as well as a summary
98280849Scy	of their state. This is equivalent to the 'peers' interactive command.
99280849Scy	_EndOfDoc_;
100280849Scy};
101181834Sroberto
102280849Scyflag = {
103298695Sdelphij    name      = refid;
104298695Sdelphij    value     = r;
105298695Sdelphij    descrip   = "Set default display type for S2+ refids";
106298695Sdelphij    arg-type  = keyword;
107298695Sdelphij    keyword   = hash, ipv4;
108298695Sdelphij    arg-default = ipv4;
109298695Sdelphij    doc = <<-  _EndOfDoc_
110298695Sdelphij	Set the default display format for S2+ refids.
111298695Sdelphij	_EndOfDoc_;
112298695Sdelphij};
113298695Sdelphij
114298695Sdelphijflag = {
115280849Scy    name      = wide;
116280849Scy    value     = w;
117280849Scy    descrip   = "Display the full 'remote' value";
118280849Scy    doc = <<-  _EndOfDoc_
119280849Scy	Display the full value of the 'remote' value.  If this requires
120280849Scy	more than 15 characters, display the full value, emit a newline,
121280849Scy	and continue the data display properly indented on the next line.
122280849Scy	_EndOfDoc_;
123280849Scy};
124181834Sroberto
125280849Scydoc-section	= {
126280849Scy  ds-type	= 'DESCRIPTION';
127280849Scy  ds-format	= 'mdoc';
128280849Scy  ds-text	= <<-  _END_PROG_MDOC_DESCRIP
129330106Sdelphij.Pp
130280849ScyThe
131280849Scy.Nm
132330106Sdelphijutility program is used to query NTP servers to monitor NTP operations
133330106Sdelphijand performance, requesting
134280849Scyinformation about current state and/or changes in that state.
135280849ScyThe program may be run either in interactive mode or controlled using
136280849Scycommand line arguments.
137280849ScyRequests to read and write arbitrary
138280849Scyvariables can be assembled, with raw and pretty-printed output
139280849Scyoptions being available.
140280849ScyThe
141280849Scy.Nm
142280849Scyutility can also obtain and print a
143280849Scylist of peers in a common format by sending multiple queries to the
144280849Scyserver.
145330106Sdelphij.Pp
146280849ScyIf one or more request options is included on the command line
147280849Scywhen
148280849Scy.Nm
149280849Scyis executed, each of the requests will be sent
150280849Scyto the NTP servers running on each of the hosts given as command
151280849Scyline arguments, or on localhost by default.
152280849ScyIf no request options
153280849Scyare given,
154280849Scy.Nm
155280849Scywill attempt to read commands from the
156280849Scystandard input and execute these on the NTP server running on the
157280849Scyfirst host given on the command line, again defaulting to localhost
158280849Scywhen no other host is specified.
159280849ScyThe
160280849Scy.Nm
161280849Scyutility will prompt for
162280849Scycommands if the standard input is a terminal device.
163330106Sdelphij.Pp
164280849Scy.Nm
165280849Scyuses NTP mode 6 packets to communicate with the
166280849ScyNTP server, and hence can be used to query any compatible server on
167280849Scythe network which permits it.
168280849ScyNote that since NTP is a UDP protocol
169280849Scythis communication will be somewhat unreliable, especially over
170280849Scylarge distances in terms of network topology.
171280849ScyThe
172280849Scy.Nm
173280849Scyutility makes
174280849Scyone attempt to retransmit requests, and will time requests out if
175280849Scythe remote host is not heard from within a suitable timeout
176280849Scytime.
177330106Sdelphij.Pp
178330106SdelphijNote that in contexts where a host name is expected, a
179330106Sdelphij.Fl 4
180330106Sdelphijqualifier preceding the host name forces resolution to the IPv4
181330106Sdelphijnamespace, while a
182330106Sdelphij.Fl 6
183330106Sdelphijqualifier forces resolution to the IPv6 namespace.
184330106SdelphijFor examples and usage, see the
185330106Sdelphij.Dq NTP Debugging Techniques
186330106Sdelphijpage.
187330106Sdelphij.Pp
188280849ScySpecifying a
189280849Scycommand line option other than
190280849Scy.Fl i
191280849Scyor
192280849Scy.Fl n
193280849Scywill
194280849Scycause the specified query (queries) to be sent to the indicated
195280849Scyhost(s) immediately.
196280849ScyOtherwise,
197280849Scy.Nm
198280849Scywill attempt to read
199280849Scyinteractive format commands from the standard input.
200330106Sdelphij
201280849Scy.Ss "Internal Commands"
202330106Sdelphij.Pp
203280849ScyInteractive format commands consist of a keyword followed by zero
204280849Scyto four arguments.
205280849ScyOnly enough characters of the full keyword to
206280849Scyuniquely identify the command need be typed.
207330106Sdelphij.Pp
208280849ScyA
209280849Scynumber of interactive format commands are executed entirely within
210280849Scythe
211280849Scy.Nm
212330106Sdelphijutility itself and do not result in NTP
213280849Scyrequests being sent to a server.
214280849ScyThese are described following.
215330106Sdelphij.Bl -tag -width "help [command]" -compact -offset indent
216330106Sdelphij.It Ic ? Op Ar command
217330106Sdelphij.It Ic help Op Ar command
218280849ScyA
219280849Scy.Ql \&?
220330106Sdelphijby itself will print a list of all the commands
221330106Sdelphijknown to
222280849Scy.Nm .
223280849ScyA
224280849Scy.Ql \&?
225330106Sdelphijfollowed by a command name will print function and usage
226280849Scyinformation about the command.
227330106Sdelphij.It Ic addvars Ar name Ns Oo \&= Ns Ar value Oc Ns Op ,...
228330106Sdelphij.It Ic rmvars Ar name Ns Op ,...
229280849Scy.It Ic clearvars
230280849Scy.It Ic showvars
231330106SdelphijThe arguments to this command consist of a list of
232280849Scyitems of the form
233330106Sdelphij.Ar name Ns Op \&= Ns Ar value ,
234280849Scywhere the
235330106Sdelphij.No \&= Ns Ar value
236280849Scyis ignored, and can be omitted,
237280849Scyin requests to the server to read variables.
238280849ScyThe
239280849Scy.Nm
240330106Sdelphijutility maintains an internal list in which data to be included in
241330106Sdelphijmessages can be assembled, and displayed or set using the
242280849Scy.Ic readlist
243280849Scyand
244280849Scy.Ic writelist
245280849Scycommands described below.
246280849ScyThe
247280849Scy.Ic addvars
248280849Scycommand allows variables and their optional values to be added to
249280849Scythe list.
250280849ScyIf more than one variable is to be added, the list should
251280849Scybe comma-separated and not contain white space.
252280849ScyThe
253280849Scy.Ic rmvars
254280849Scycommand can be used to remove individual variables from the list,
255280849Scywhile the
256330106Sdelphij.Ic clearvars
257280849Scycommand removes all variables from the
258280849Scylist.
259280849ScyThe
260280849Scy.Ic showvars
261280849Scycommand displays the current list of optional variables.
262330106Sdelphij.It Ic authenticate Op Cm yes Ns | Ns Cm no
263280849ScyNormally
264280849Scy.Nm
265280849Scydoes not authenticate requests unless
266280849Scythey are write requests.
267280849ScyThe command
268330106Sdelphij.Ic authenticate Cm yes
269280849Scycauses
270280849Scy.Nm
271280849Scyto send authentication with all requests it
272280849Scymakes.
273280849ScyAuthenticated requests causes some servers to handle
274330106Sdelphijrequests slightly differently.
275280849ScyThe command
276330106Sdelphij.Ic authenticate
277280849Scycauses
278280849Scy.Nm
279280849Scyto display whether or not
280330106Sdelphijit is currently authenticating requests.
281280849Scy.It Ic cooked
282280849ScyCauses output from query commands to be "cooked", so that
283280849Scyvariables which are recognized by
284280849Scy.Nm
285280849Scywill have their
286280849Scyvalues reformatted for human consumption.
287280849ScyVariables which
288280849Scy.Nm
289330106Sdelphijcould not decode completely are
290280849Scymarked with a trailing
291280849Scy.Ql \&? .
292330106Sdelphij.It Ic debug Op Cm more Ns | Ns Cm less Ns | Ns Cm off
293280849ScyWith no argument, displays the current debug level.
294330106SdelphijOtherwise, the debugging level is changed as indicated.
295330106Sdelphij.It Ic delay Op Ar milliseconds
296280849ScySpecify a time interval to be added to timestamps included in
297280849Scyrequests which require authentication.
298280849ScyThis is used to enable
299280849Scy(unreliable) server reconfiguration over long delay network paths
300280849Scyor between machines whose clocks are unsynchronized.
301280849ScyActually the
302280849Scyserver does not now require timestamps in authenticated requests,
303280849Scyso this command may be obsolete.
304330106SdelphijWithout any arguments, displays the current delay.
305330106Sdelphij.It Ic drefid Op Cm hash Ns | Ns Cm ipv4
306330106SdelphijDisplay refids as IPv4 or hash.
307330106SdelphijWithout any arguments, displays whether refids are shown as IPv4
308330106Sdelphijaddresses or hashes.
309280849Scy.It Ic exit
310280849ScyExit
311280849Scy.Nm .
312330106Sdelphij.It Ic host Op Ar name
313280849ScySet the host to which future queries will be sent.
314330106SdelphijThe
315330106Sdelphij.Ar name
316280849Scymay be either a host name or a numeric address.
317330106SdelphijWithout any arguments, displays the current host.
318330106Sdelphij.It Ic hostnames Op Cm yes Ns | Ns Cm no
319280849ScyIf
320280849Scy.Cm yes
321280849Scyis specified, host names are printed in
322280849Scyinformation displays.
323280849ScyIf
324280849Scy.Cm no
325280849Scyis specified, numeric
326280849Scyaddresses are printed instead.
327280849ScyThe default is
328280849Scy.Cm yes ,
329280849Scyunless
330280849Scymodified using the command line
331280849Scy.Fl n
332280849Scyswitch.
333330106SdelphijWithout any arguments, displays whether host names or numeric addresses
334330106Sdelphijare shown.
335330106Sdelphij.It Ic keyid Op Ar keyid
336280849ScyThis command allows the specification of a key number to be
337280849Scyused to authenticate configuration requests.
338280849ScyThis must correspond
339285169Scyto the
340285169Scy.Cm controlkey
341285169Scykey number the server has been configured to use for this
342280849Scypurpose.
343330106SdelphijWithout any arguments, displays the current
344330106Sdelphij.Ar keyid .
345330106Sdelphij.It Ic keytype Op Ar digest
346330106SdelphijSpecify the digest algorithm to use for authenticating requests, with default
347330106Sdelphij.Cm MD5 .
348280849ScyIf
349280849Scy.Nm
350330106Sdelphijwas built with OpenSSL support, and OpenSSL is installed,
351330106Sdelphij.Ar digest
352330106Sdelphijcan be any message digest algorithm supported by OpenSSL.
353280849ScyIf no argument is given, the current
354330106Sdelphij.Ic keytype Ar digest
355330106Sdelphijalgorithm used is displayed.
356330106Sdelphij.It Ic ntpversion Op Cm 1 Ns | Ns Cm 2 Ns | Ns Cm 3 Ns | Ns Cm 4
357280849ScySets the NTP version number which
358280849Scy.Nm
359280849Scyclaims in
360280849Scypackets.
361280849ScyDefaults to 3, and note that mode 6 control messages (and
362280849Scymodes, for that matter) didn't exist in NTP version 1.
363280849ScyThere appear
364280849Scyto be no servers left which demand version 1.
365280849ScyWith no argument, displays the current NTP version that will be used
366280849Scywhen communicating with servers.
367280849Scy.It Ic passwd
368280849ScyThis command prompts you to type in a password (which will not
369280849Scybe echoed) which will be used to authenticate configuration
370280849Scyrequests.
371280849ScyThe password must correspond to the key configured for
372280849Scyuse by the NTP server for this purpose if such requests are to be
373280849Scysuccessful.
374330106Sdelphij.It Ic poll Oo Ar n Oc Op Cm verbose
375330106SdelphijPoll an NTP server in client mode
376330106Sdelphij.Ar n
377330106Sdelphijtimes.
378330106SdelphijPoll not implemented yet.
379280849Scy.It Ic quit
380280849ScyExit
381280849Scy.Nm .
382280849Scy.It Ic raw
383280849ScyCauses all output from query commands is printed as received
384280849Scyfrom the remote server.
385280849ScyThe only formating/interpretation done on
386280849Scythe data is to transform nonascii data into a printable (but barely
387280849Scyunderstandable) form.
388330106Sdelphij.It Ic timeout Op Ar milliseconds
389280849ScySpecify a timeout period for responses to server queries.
390280849ScyThe
391280849Scydefault is about 5000 milliseconds.
392330106SdelphijWithout any arguments, displays the current timeout period.
393280849ScyNote that since
394280849Scy.Nm
395280849Scyretries each query once after a timeout, the total waiting time for
396280849Scya timeout will be twice the timeout value set.
397280849Scy.It Ic version
398330106SdelphijDisplay the version of the
399280849Scy.Nm
400280849Scyprogram.
401280849Scy.El
402280849Scy
403280849Scy.Ss "Control Message Commands"
404330106SdelphijAssociation ids are used to identify system, peer and clock variables.
405330106SdelphijSystem variables are assigned an association id of zero and system name
406330106Sdelphijspace, while each association is assigned a nonzero association id and
407330106Sdelphijpeer namespace.
408330106SdelphijMost control commands send a single message to the server and expect a
409330106Sdelphijsingle response message.
410280849ScyThe exceptions are the
411330106Sdelphij.Ic peers
412280849Scycommand, which sends a series of messages,
413280849Scyand the
414330106Sdelphij.Ic mreadlist
415280849Scyand
416330106Sdelphij.Ic mreadvar
417280849Scycommands, which iterate over a range of associations.
418280849Scy.Bl -tag -width "something" -compact -offset indent
419330106Sdelphij.It Ic apeers
420330106SdelphijDisplay a list of peers in the form:
421330106Sdelphij.Dl [tally]remote refid assid st t when pool reach delay offset jitter
422330106Sdelphijwhere the output is just like the
423330106Sdelphij.Ic peers
424330106Sdelphijcommand except that the
425330106Sdelphij.Cm refid
426330106Sdelphijis displayed in hex format and the association number is also displayed.
427330106Sdelphij.It Ic associations
428280849ScyDisplay a list of mobilized associations in the form:
429280849Scy.Dl ind assid status conf reach auth condition last_event cnt
430330106Sdelphij.Bl -column -offset indent ".Sy Variable" "see the select field of the peer status word"
431330106Sdelphij.It Sy Variable Ta Sy Description
432330106Sdelphij.It Cm ind Ta index on this list
433330106Sdelphij.It Cm assid Ta association id
434330106Sdelphij.It Cm status Ta peer status word
435330106Sdelphij.It Cm conf Ta Cm yes : No persistent, Cm no : No ephemeral
436330106Sdelphij.It Cm reach Ta Cm yes : No reachable, Cm no : No unreachable
437330106Sdelphij.It Cm auth Ta Cm ok , Cm yes , Cm bad No and Cm none
438330106Sdelphij.It Cm condition Ta selection status \&(see the Cm select No field of the peer status word\&)
439330106Sdelphij.It Cm last_event Ta event report \&(see the Cm event No field of the peer status word\&)
440330106Sdelphij.It Cm cnt Ta event count \&(see the Cm count No field of the peer status word\&)
441280849Scy.El
442330106Sdelphij.It Ic authinfo
443330106SdelphijDisplay the authentication statistics counters:
444330106Sdelphijtime since reset, stored keys, free keys, key lookups, keys not found,
445330106Sdelphijuncached keys, expired keys, encryptions, decryptions.
446330106Sdelphij.It Ic clocklist Op Ar associd
447330106Sdelphij.It Ic cl Op Ar associd
448330106SdelphijDisplay all clock variables in the variable list for those associations
449330106Sdelphijsupporting a reference clock.
450330106Sdelphij.It Ic clockvar Oo Ar associd Oc Oo Ar name Ns Oo \&= Ns Ar value Oc Ns Oc Ns Op ,...
451330106Sdelphij.It Ic cv Oo Ar associd Oc Oo Ar name Ns Oo \&= Ns Ar value Oc Ns Oc Ns Op ,...
452330106SdelphijDisplay a list of clock variables for those associations supporting a
453330106Sdelphijreference clock.
454330106Sdelphij.It Ic :config Ar "configuration command line"
455330106SdelphijSend the remainder of the command line, including whitespace, to the
456330106Sdelphijserver as a run-time configuration command in the same format as a line
457330106Sdelphijin the configuration file.
458330106SdelphijThis command is experimental until further notice and clarification.
459330106SdelphijAuthentication is of course required.
460330106Sdelphij.It Ic config-from-file Ar filename
461330106SdelphijSend each line of
462280849Scy.Ar filename
463330106Sdelphijto the server as run-time configuration commands in the same format as
464330106Sdelphijlines in the configuration file.
465330106SdelphijThis command is experimental until further notice and clarification.
466330106SdelphijAuthentication is required.
467280849Scy.It Ic ifstats
468330106SdelphijDisplay status and statistics counters for each local network interface address:
469330106Sdelphijinterface number, interface name and address or broadcast, drop, flag,
470330106Sdelphijttl, mc, received, sent, send failed, peers, uptime.
471330106SdelphijAuthentication is required.
472280849Scy.It Ic iostats
473330106SdelphijDisplay network and reference clock I/O statistics:
474330106Sdelphijtime since reset, receive buffers, free receive buffers, used receive buffers,
475330106Sdelphijlow water refills, dropped packets, ignored packets, received packets,
476330106Sdelphijpackets sent, packet send failures, input wakeups, useful input wakeups.
477280849Scy.It Ic kerninfo
478330106SdelphijDisplay kernel loop and PPS statistics:
479330106Sdelphijassocid, status, pll offset, pll frequency, maximum error,
480330106Sdelphijestimated error, kernel status, pll time constant, precision,
481330106Sdelphijfrequency tolerance, pps frequency, pps stability, pps jitter,
482330106Sdelphijcalibration interval, calibration cycles, jitter exceeded,
483330106Sdelphijstability exceeded, calibration errors.
484330106SdelphijAs with other ntpq output, times are in milliseconds; very small values
485330106Sdelphijmay be shown as exponentials.
486330106SdelphijThe precision value displayed is in milliseconds as well, unlike the
487330106Sdelphijprecision system variable.
488280849Scy.It Ic lassociations
489330106SdelphijPerform the same function as the associations command, except display
490330106Sdelphijmobilized and unmobilized associations, including all clients.
491330106Sdelphij.It Ic lopeers Op Fl 4 Ns | Ns Fl 6
492330106SdelphijDisplay a list of all peers and clients showing
493330106Sdelphij.Cm dstadr
494330106Sdelphij(associated with the given IP version).
495330106Sdelphij.It Ic lpassociations
496330106SdelphijDisplay the last obtained list of associations, including all clients.
497330106Sdelphij.It Ic lpeers Op Fl 4 Ns | Ns Fl 6
498330106SdelphijDisplay a list of all peers and clients (associated with the given IP version).
499330106Sdelphij.It Ic monstats
500330106SdelphijDisplay monitor facility status, statistics, and limits:
501330106Sdelphijenabled, addresses, peak addresses, maximum addresses,
502330106Sdelphijreclaim above count, reclaim older than, kilobytes, maximum kilobytes.
503330106Sdelphij.It Ic mreadlist Ar associdlo Ar associdhi
504330106Sdelphij.It Ic mrl Ar associdlo Ar associdhi
505330106SdelphijPerform the same function as the
506330106Sdelphij.Ic readlist
507330106Sdelphijcommand for a range of association ids.
508330106Sdelphij.It Ic mreadvar Ar associdlo Ar associdhi Oo Ar name Oc Ns Op ,...
509330106SdelphijThis range may be determined from the list displayed by any
510330106Sdelphijcommand showing associations.
511330106Sdelphij.It Ic mrv Ar associdlo Ar associdhi Oo Ar name Oc Ns Op ,...
512330106SdelphijPerform the same function as the
513330106Sdelphij.Ic readvar
514330106Sdelphijcommand for a range of association ids.
515330106SdelphijThis range may be determined from the list displayed by any
516330106Sdelphijcommand showing associations.
517330106Sdelphij.It Xo Ic mrulist Oo Cm limited | Cm kod | Cm mincount Ns \&= Ns Ar count |
518330106Sdelphij.Cm laddr Ns \&= Ns Ar localaddr | Cm sort Ns \&= Ns Oo \&- Oc Ns Ar sortorder |
519330106Sdelphij.Cm resany Ns \&= Ns Ar hexmask | Cm resall Ns \&= Ns Ar hexmask Oc
520280849Scy.Xc
521330106SdelphijDisplay traffic counts of the most recently seen source addresses
522330106Sdelphijcollected and maintained by the monitor facility.
523280849ScyWith the exception of
524330106Sdelphij.Cm sort Ns \&= Ns Oo \&- Oc Ns Ar sortorder ,
525280849Scythe options filter the list returned by
526330106Sdelphij.Xr ntpd 8 .
527280849ScyThe
528280849Scy.Cm limited
529280849Scyand
530280849Scy.Cm kod
531330106Sdelphijoptions return only entries representing client addresses from which the
532330106Sdelphijlast packet received triggered either discarding or a KoD response.
533280849ScyThe
534280849Scy.Cm mincount Ns = Ns Ar count
535280849Scyoption filters entries representing less than
536280849Scy.Ar count
537280849Scypackets.
538280849ScyThe
539280849Scy.Cm laddr Ns = Ns Ar localaddr
540280849Scyoption filters entries for packets received on any local address other than
541280849Scy.Ar localaddr .
542280849Scy.Cm resany Ns = Ns Ar hexmask
543280849Scyand
544280849Scy.Cm resall Ns = Ns Ar hexmask
545280849Scyfilter entries containing none or less than all, respectively, of the bits in
546280849Scy.Ar hexmask ,
547280849Scywhich must begin with
548280849Scy.Cm 0x .
549280849ScyThe
550280849Scy.Ar sortorder
551280849Scydefaults to
552280849Scy.Cm lstint
553330106Sdelphijand may be 
554280849Scy.Cm addr ,
555330106Sdelphij.Cm avgint ,
556280849Scy.Cm count ,
557280849Scy.Cm lstint ,
558330106Sdelphijor any of those preceded by
559330106Sdelphij.Ql \&-
560330106Sdelphijto reverse the sort order.
561280849ScyThe output columns are:
562280849Scy.Bl -tag -width "something" -compact -offset indent
563280849Scy.It Column
564280849ScyDescription
565280849Scy.It Ic lstint
566330106SdelphijInterval in seconds between the receipt of the most recent packet from
567330106Sdelphijthis address and the completion of the retrieval of the MRU list by
568280849Scy.Nm .
569280849Scy.It Ic avgint
570280849ScyAverage interval in s between packets from this address.
571280849Scy.It Ic rstr
572280849ScyRestriction flags associated with this address.
573280849ScyMost are copied unchanged from the matching
574280849Scy.Ic restrict
575330106Sdelphijcommand, however 0x400 (kod) and 0x20 (limited) flags are cleared unless
576330106Sdelphijthe last packet from this address triggered a rate control response.
577280849Scy.It Ic r
578280849ScyRate control indicator, either
579280849Scya period,
580280849Scy.Ic L
581280849Scyor
582280849Scy.Ic K
583280849Scyfor no rate control response,
584280849Scyrate limiting by discarding, or rate limiting with a KoD response, respectively.
585280849Scy.It Ic m
586280849ScyPacket mode.
587280849Scy.It Ic v
588280849ScyPacket version number.
589280849Scy.It Ic count
590280849ScyPackets received from this address.
591280849Scy.It Ic rport
592280849ScySource port of last packet from this address.
593280849Scy.It Ic remote address
594330106Sdelphijhost or DNS name, numeric address, or address followed by
595280849Scyclaimed DNS name which could not be verified in parentheses.
596280849Scy.El
597330106Sdelphij.It Ic opeers Op Fl 4 | Fl 6
598280849ScyObtain and print the old-style list of all peers and clients showing
599330106Sdelphij.Cm dstadr
600330106Sdelphij(associated with the given IP version),
601280849Scyrather than the
602330106Sdelphij.Cm refid .
603280849Scy.It Ic passociations
604280849ScyPerform the same function as the
605280849Scy.Ic associations
606280849Scycommand,
607280849Scyexcept that it uses previously stored data rather than making a new query.
608280849Scy.It Ic peers
609280849ScyDisplay a list of peers in the form:
610280849Scy.Dl [tally]remote refid st t when pool reach delay offset jitter
611280849Scy.Bl -tag -width "something" -compact -offset indent
612280849Scy.It Variable
613280849ScyDescription
614330106Sdelphij.It Cm [tally]
615280849Scysingle-character code indicating current value of the
616280849Scy.Ic select
617280849Scyfield of the
618280849Scy.Lk decode.html#peer "peer status word"
619330106Sdelphij.It Cm remote
620280849Scyhost name (or IP number) of peer.
621330106SdelphijThe value displayed will be truncated to 15 characters unless the
622330106Sdelphij.Nm
623280849Scy.Fl w
624330106Sdelphijoption is given, in which case the full value will be displayed
625330106Sdelphijon the first line, and if too long,
626330106Sdelphijthe remaining data will be displayed on the next line.
627330106Sdelphij.It Cm refid
628330106Sdelphijsource IP address or
629280849Scy.Lk decode.html#kiss "'kiss code"
630330106Sdelphij.It Cm st
631330106Sdelphijstratum: 0 for local reference clocks, 1 for servers with local
632330106Sdelphijreference clocks, ..., 16 for unsynchronized server clocks
633330106Sdelphij.It Cm t
634280849Scy.Ic u :
635280849Scyunicast or manycast client,
636280849Scy.Ic b :
637280849Scybroadcast or multicast client,
638330106Sdelphij.Ic p :
639330106Sdelphijpool source,
640280849Scy.Ic l :
641280849Scylocal (reference clock),
642280849Scy.Ic s :
643280849Scysymmetric (peer),
644280849Scy.Ic A :
645280849Scymanycast server,
646280849Scy.Ic B :
647280849Scybroadcast server,
648280849Scy.Ic M :
649280849Scymulticast server
650330106Sdelphij.It Cm when
651330106Sdelphijtime in seconds, minutes, hours, or days since the last packet
652330106Sdelphijwas received, or
653330106Sdelphij.Ql \&-
654330106Sdelphijif a packet has never been received
655330106Sdelphij.It Cm poll
656330106Sdelphijpoll interval (s)
657330106Sdelphij.It Cm reach
658280849Scyreach shift register (octal)
659330106Sdelphij.It Cm delay
660280849Scyroundtrip delay
661330106Sdelphij.It Cm offset
662280849Scyoffset of server relative to this host
663330106Sdelphij.It Cm jitter
664330106Sdelphijoffset RMS error estimate.
665280849Scy.El
666330106Sdelphij.It Ic pstats Ar associd
667330106SdelphijDisplay the statistics for the peer with the given
668330106Sdelphij.Ar associd :
669330106Sdelphijassocid, status, remote host, local address, time last received,
670330106Sdelphijtime until next send, reachability change, packets sent,
671330106Sdelphijpackets received, bad authentication, bogus origin, duplicate,
672330106Sdelphijbad dispersion, bad reference time, candidate order.
673330106Sdelphij.It Ic readlist Op Ar associd
674330106Sdelphij.It Ic rl Op Ar associd
675330106SdelphijDisplay all system or peer variables.
676330106SdelphijIf the
677330106Sdelphij.Ar associd
678330106Sdelphijis omitted, it is assumed to be zero.
679330106Sdelphij.It Ic readvar Op Ar associd Ar name Ns Oo Ns = Ns Ar value Oc Op , ...
680330106Sdelphij.It Ic rv Op Ar associd Ar name Ns Oo Ns = Ns Ar value Oc Op , ...
681330106SdelphijDisplay the specified system or peer variables.
682280849ScyIf
683330106Sdelphij.Ar associd
684280849Scyis zero, the variables are from the
685280849Scy.Sx System Variables
686280849Scyname space, otherwise they are from the
687280849Scy.Sx Peer Variables
688280849Scyname space.
689280849ScyThe
690330106Sdelphij.Ar associd
691280849Scyis required, as the same name can occur in both spaces.
692280849ScyIf no
693280849Scy.Ar name
694280849Scyis included, all operative variables in the name space are displayed.
695280849ScyIn this case only, if the
696330106Sdelphij.Ar associd
697330106Sdelphijis omitted, it is assumed to be zero.
698280849ScyMultiple names are specified with comma separators and without whitespace.
699280849ScyNote that time values are represented in milliseconds
700280849Scyand frequency values in parts-per-million (PPM).
701280849ScySome NTP timestamps are represented in the format
702330106Sdelphij.Ar YYYY Ns Ar MM Ar DD Ar TTTT ,
703330106Sdelphijwhere
704330106Sdelphij.Ar YYYY
705330106Sdelphijis the year,
706330106Sdelphij.Ar MM
707330106Sdelphijthe month of year,
708330106Sdelphij.Ar DD
709330106Sdelphijthe day of month and
710330106Sdelphij.Ar TTTT
711330106Sdelphijthe time of day.
712280849Scy.It Ic reslist
713330106SdelphijDisplay the access control (restrict) list for
714280849Scy.Nm .
715330106SdelphijAuthentication is required.
716280849Scy.It Ic saveconfig Ar filename
717330106SdelphijSave the current configuration,
718330106Sdelphijincluding any runtime modifications made by
719280849Scy.Ic :config
720280849Scyor
721280849Scy.Ic config-from-file ,
722330106Sdelphijto the NTP server host file
723280849Scy.Ar filename .
724280849ScyThis command will be rejected by the server unless
725280849Scy.Lk miscopt.html#saveconfigdir "saveconfigdir"
726280849Scyappears in the
727330106Sdelphij.Xr ntpd 8
728280849Scyconfiguration file.
729280849Scy.Ar filename
730280849Scycan use
731330106Sdelphij.Xr date 1
732330106Sdelphijformat specifiers to substitute the current date and time, for
733330106Sdelphijexample,
734330106Sdelphij.D1 Ic saveconfig Pa ntp-%Y%m%d-%H%M%S.conf .
735280849ScyThe filename used is stored in system variable
736330106Sdelphij.Cm savedconfig .
737280849ScyAuthentication is required.
738330106Sdelphij.It Ic sysinfo
739330106SdelphijDisplay system operational summary:
740330106Sdelphijassocid, status, system peer, system peer mode, leap indicator,
741330106Sdelphijstratum, log2 precision, root delay, root dispersion,
742330106Sdelphijreference id, reference time, system jitter, clock jitter,
743330106Sdelphijclock wander, broadcast delay, symm. auth. delay.
744330106Sdelphij.It Ic sysstats
745330106SdelphijDisplay system uptime and packet counts maintained in the
746330106Sdelphijprotocol module:
747330106Sdelphijuptime, sysstats reset, packets received, current version,
748330106Sdelphijolder version, bad length or format, authentication failed,
749330106Sdelphijdeclined, restricted, rate limited, KoD responses,
750330106Sdelphijprocessed for time.
751280849Scy.It Ic timerstats
752330106SdelphijDisplay interval timer counters:
753330106Sdelphijtime since reset, timer overruns, calls to transmit.
754330106Sdelphij.It Ic writelist Ar associd
755330106SdelphijSet all system or peer variables included in the variable list.
756330106Sdelphij.It Ic writevar Ar associd Ar name Ns = Ns Ar value Op , ...
757330106SdelphijSet the specified variables in the variable list.
758280849ScyIf the
759330106Sdelphij.Ar associd
760280849Scyis zero, the variables are from the
761280849Scy.Sx System Variables
762280849Scyname space, otherwise they are from the
763280849Scy.Sx Peer Variables
764280849Scyname space.
765280849ScyThe
766330106Sdelphij.Ar associd
767280849Scyis required, as the same name can occur in both spaces.
768330106SdelphijAuthentication is required.
769280849Scy.El
770280849Scy
771280849Scy.Ss Status Words and Kiss Codes
772280849ScyThe current state of the operating program is shown
773280849Scyin a set of status words
774280849Scymaintained by the system.
775280849ScyStatus information is also available on a per-association basis.
776330106SdelphijThese words are displayed by the
777330106Sdelphij.Ic readlist
778280849Scyand
779330106Sdelphij.Ic associations
780280849Scycommands both in hexadecimal and in decoded short tip strings.
781280849ScyThe codes, tips and short explanations are documented on the
782280849Scy.Lk decode.html "Event Messages and Status Words"
783280849Scypage.
784280849ScyThe page also includes a list of system and peer messages,
785280849Scythe code for the latest of which is included in the status word.
786280849Scy.Pp
787280849ScyInformation resulting from protocol machine state transitions
788280849Scyis displayed using an informal set of ASCII strings called
789280849Scy.Lk decode.html#kiss "kiss codes" .
790280849ScyThe original purpose was for kiss-o'-death (KoD) packets
791280849Scysent by the server to advise the client of an unusual condition.
792280849ScyThey are now displayed, when appropriate,
793280849Scyin the reference identifier field in various billboards.
794280849Scy
795280849Scy.Ss System Variables
796280849ScyThe following system variables appear in the
797330106Sdelphij.Ic readlist
798280849Scybillboard.
799280849ScyNot all variables are displayed in some configurations.
800330106Sdelphij.Pp
801280849Scy.Bl -tag -width "something" -compact -offset indent
802280849Scy.It Variable
803280849ScyDescription
804330106Sdelphij.It Cm status
805280849Scy.Lk decode.html#sys "system status word"
806330106Sdelphij.It Cm version
807280849ScyNTP software version and build time
808330106Sdelphij.It Cm processor
809280849Scyhardware platform and version
810330106Sdelphij.It Cm system
811280849Scyoperating system and version
812330106Sdelphij.It Cm leap
813280849Scyleap warning indicator (0-3)
814330106Sdelphij.It Cm stratum
815280849Scystratum (1-15)
816330106Sdelphij.It Cm precision
817280849Scyprecision (log2 s)
818330106Sdelphij.It Cm rootdelay
819280849Scytotal roundtrip delay to the primary reference clock
820330106Sdelphij.It Cm rootdisp
821280849Scytotal dispersion to the primary reference clock
822330106Sdelphij.It Cm refid
823330106Sdelphijreference id or
824330106Sdelphij.Lk decode.html#kiss "kiss code"
825330106Sdelphij.It Cm reftime
826330106Sdelphijreference time
827330106Sdelphij.It Ic clock
828330106Sdelphijdate and time of day
829330106Sdelphij.It Cm peer
830330106Sdelphijsystem peer association id
831330106Sdelphij.It Cm tc
832280849Scytime constant and poll exponent (log2 s) (3-17)
833330106Sdelphij.It Cm mintc
834280849Scyminimum time constant (log2 s) (3-10)
835330106Sdelphij.It Cm offset
836330106Sdelphijcombined offset of server relative to this host
837330106Sdelphij.It Cm frequency
838330106Sdelphijfrequency drift (PPM) relative to hardware clock
839330106Sdelphij.It Cm sys_jitter
840280849Scycombined system jitter
841330106Sdelphij.It Cm clk_wander
842280849Scyclock frequency wander (PPM)
843330106Sdelphij.It Cm clk_jitter
844280849Scyclock jitter
845330106Sdelphij.It Cm tai
846280849ScyTAI-UTC offset (s)
847330106Sdelphij.It Cm leapsec
848280849ScyNTP seconds when the next leap second is/was inserted
849330106Sdelphij.It Cm expire
850280849ScyNTP seconds when the NIST leapseconds file expires
851280849Scy.El
852280849ScyThe jitter and wander statistics are exponentially-weighted RMS averages.
853280849ScyThe system jitter is defined in the NTPv4 specification;
854280849Scythe clock jitter statistic is computed by the clock discipline module.
855280849Scy.Pp
856280849ScyWhen the NTPv4 daemon is compiled with the OpenSSL software library,
857280849Scyadditional system variables are displayed,
858280849Scyincluding some or all of the following,
859280849Scydepending on the particular Autokey dance:
860280849Scy.Bl -tag -width "something" -compact -offset indent
861280849Scy.It Variable
862280849ScyDescription
863330106Sdelphij.It Cm host
864280849ScyAutokey host name for this host
865330106Sdelphij.It Cm ident
866280849ScyAutokey group name for this host
867330106Sdelphij.It Cm flags
868280849Scyhost flags  (see Autokey specification)
869330106Sdelphij.It Cm digest
870280849ScyOpenSSL message digest algorithm
871330106Sdelphij.It Cm signature
872280849ScyOpenSSL digest/signature scheme
873330106Sdelphij.It Cm update
874280849ScyNTP seconds at last signature update
875330106Sdelphij.It Cm cert
876280849Scycertificate subject, issuer and certificate flags
877330106Sdelphij.It Cm until
878280849ScyNTP seconds when the certificate expires
879280849Scy.El
880280849Scy.Ss Peer Variables
881280849ScyThe following peer variables appear in the
882330106Sdelphij.Ic readlist
883280849Scybillboard for each association.
884280849ScyNot all variables are displayed in some configurations.
885330106Sdelphij.Pp
886280849Scy.Bl -tag -width "something" -compact -offset indent
887280849Scy.It Variable
888280849ScyDescription
889330106Sdelphij.It Cm associd
890330106Sdelphijassociation id
891330106Sdelphij.It Cm status
892280849Scy.Lk decode.html#peer "peer status word"
893330106Sdelphij.It Cm srcadr
894280849Scysource (remote) IP address
895330106Sdelphij.It Cm srcport
896280849Scysource (remote) port
897330106Sdelphij.It Cm dstadr
898280849Scydestination (local) IP address
899330106Sdelphij.It Cm dstport
900280849Scydestination (local) port
901330106Sdelphij.It Cm leap
902280849Scyleap indicator (0-3)
903330106Sdelphij.It Cm stratum
904280849Scystratum (0-15)
905330106Sdelphij.It Cm precision
906280849Scyprecision (log2 s)
907330106Sdelphij.It Cm rootdelay
908280849Scytotal roundtrip delay to the primary reference clock
909330106Sdelphij.It Cm rootdisp
910280849Scytotal root dispersion to the primary reference clock
911330106Sdelphij.It Cm refid
912330106Sdelphijreference id or
913280849Scy.Lk decode.html#kiss "kiss code"
914330106Sdelphij.It Cm reftime
915280849Scyreference time
916330106Sdelphij.It Cm rec
917330106Sdelphijlast packet received time
918330106Sdelphij.It Cm reach
919280849Scyreach register (octal)
920330106Sdelphij.It Cm unreach
921280849Scyunreach counter
922330106Sdelphij.It Cm hmode
923280849Scyhost mode (1-6)
924330106Sdelphij.It Cm pmode
925280849Scypeer mode (1-5)
926330106Sdelphij.It Cm hpoll
927280849Scyhost poll exponent (log2 s) (3-17)
928330106Sdelphij.It Cm ppoll
929280849Scypeer poll exponent (log2 s) (3-17)
930330106Sdelphij.It Cm headway
931280849Scyheadway (see
932280849Scy.Lk rate.html "Rate Management and the Kiss-o'-Death Packet" )
933330106Sdelphij.It Cm flash
934280849Scy.Lk decode.html#flash "flash status word"
935330106Sdelphij.It Cm keyid
936330106Sdelphijsymmetric key id
937330106Sdelphij.It Cm offset
938280849Scyfilter offset
939330106Sdelphij.It Cm delay
940280849Scyfilter delay
941330106Sdelphij.It Cm dispersion
942280849Scyfilter dispersion
943330106Sdelphij.It Cm jitter
944280849Scyfilter jitter
945330106Sdelphij.It Cm bias
946280849Scyunicast/broadcast bias
947330106Sdelphij.It Cm xleave
948280849Scyinterleave delay (see
949280849Scy.Lk xleave.html "NTP Interleaved Modes" )
950280849Scy.El
951280849ScyThe
952330106Sdelphij.Cm bias
953280849Scyvariable is calculated when the first broadcast packet is received
954280849Scyafter the calibration volley.
955330106SdelphijIt represents the offset of the broadcast subgraph relative to the
956330106Sdelphijunicast subgraph.
957280849ScyThe
958330106Sdelphij.Cm xleave
959280849Scyvariable appears only for the interleaved symmetric and interleaved modes.
960280849ScyIt represents the internal queuing, buffering and transmission delays
961280849Scyfor the preceding packet.
962280849Scy.Pp
963280849ScyWhen the NTPv4 daemon is compiled with the OpenSSL software library,
964280849Scyadditional peer variables are displayed, including the following:
965280849Scy.Bl -tag -width "something" -compact -offset indent
966280849Scy.It Variable
967280849ScyDescription
968330106Sdelphij.It Cm flags
969280849Scypeer flags (see Autokey specification)
970330106Sdelphij.It Cm host
971280849ScyAutokey server name
972330106Sdelphij.It Cm flags
973280849Scypeer flags (see Autokey specification)
974330106Sdelphij.It Cm signature
975280849ScyOpenSSL digest/signature scheme
976330106Sdelphij.It Cm initsequence
977330106Sdelphijinitial key id
978330106Sdelphij.It Cm initkey
979280849Scyinitial key index
980330106Sdelphij.It Cm timestamp
981280849ScyAutokey signature timestamp
982330106Sdelphij.It Cm ident
983330106SdelphijAutokey group name for this association
984280849Scy.El
985280849Scy
986280849Scy.Ss Clock Variables
987280849ScyThe following clock variables appear in the
988330106Sdelphij.Ic clocklist
989280849Scybillboard for each association with a reference clock.
990280849ScyNot all variables are displayed in some configurations.
991280849Scy.Bl -tag -width "something" -compact -offset indent
992280849Scy.It Variable
993280849ScyDescription
994330106Sdelphij.It Cm associd
995330106Sdelphijassociation id
996330106Sdelphij.It Cm status
997280849Scy.Lk decode.html#clock "clock status word"
998330106Sdelphij.It Cm device
999280849Scydevice description
1000330106Sdelphij.It Cm timecode
1001280849ScyASCII time code string (specific to device)
1002330106Sdelphij.It Cm poll
1003280849Scypoll messages sent
1004330106Sdelphij.It Cm noreply
1005280849Scyno reply
1006330106Sdelphij.It Cm badformat
1007280849Scybad format
1008330106Sdelphij.It Cm baddata
1009280849Scybad date or time
1010330106Sdelphij.It Cm fudgetime1
1011280849Scyfudge time 1
1012330106Sdelphij.It Cm fudgetime2
1013280849Scyfudge time 2
1014330106Sdelphij.It Cm stratum
1015280849Scydriver stratum
1016330106Sdelphij.It Cm refid
1017330106Sdelphijdriver reference id
1018330106Sdelphij.It Cm flags
1019280849Scydriver flags
1020280849Scy.El
1021280849Scy	_END_PROG_MDOC_DESCRIP;
1022280849Scy};
1023