]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/ntp/ntpq/invoke-ntpq.texi
Update LLDB snapshot to upstream r241361
[FreeBSD/FreeBSD.git] / contrib / ntp / ntpq / invoke-ntpq.texi
1 @node ntpq Invocation
2 @section Invoking ntpq
3 @pindex ntpq
4 @cindex standard NTP query program
5 @ignore
6 #
7 # EDIT THIS FILE WITH CAUTION  (invoke-ntpq.texi)
8 #
9 # It has been AutoGen-ed  April  7, 2015 at 04:27:07 AM by AutoGen 5.18.5pre4
10 # From the definitions    ntpq-opts.def
11 # and the template file   agtexi-cmd.tpl
12 @end ignore
13
14
15 The
16 @code{ntpq}
17 utility program is used to query NTP servers which
18 implement the standard NTP mode 6 control message formats defined
19 in Appendix B of the NTPv3 specification RFC1305, requesting
20 information about current state and/or changes in that state.
21 The same formats are used in NTPv4, although some of the
22 variables have changed and new ones added. The description on this
23 page is for the NTPv4 variables.
24 The program may be run either in interactive mode or controlled using
25 command line arguments.
26 Requests to read and write arbitrary
27 variables can be assembled, with raw and pretty-printed output
28 options being available.
29 The
30 @code{ntpq}
31 utility can also obtain and print a
32 list of peers in a common format by sending multiple queries to the
33 server.
34
35 If one or more request options is included on the command line
36 when
37 @code{ntpq}
38 is executed, each of the requests will be sent
39 to the NTP servers running on each of the hosts given as command
40 line arguments, or on localhost by default.
41 If no request options
42 are given,
43 @code{ntpq}
44 will attempt to read commands from the
45 standard input and execute these on the NTP server running on the
46 first host given on the command line, again defaulting to localhost
47 when no other host is specified.
48 The
49 @code{ntpq}
50 utility will prompt for
51 commands if the standard input is a terminal device.
52
53 @code{ntpq}
54 uses NTP mode 6 packets to communicate with the
55 NTP server, and hence can be used to query any compatible server on
56 the network which permits it.
57 Note that since NTP is a UDP protocol
58 this communication will be somewhat unreliable, especially over
59 large distances in terms of network topology.
60 The
61 @code{ntpq}
62 utility makes
63 one attempt to retransmit requests, and will time requests out if
64 the remote host is not heard from within a suitable timeout
65 time.
66
67 Specifying a
68 command line option other than
69 @code{-i}
70 or
71 @code{-n}
72 will
73 cause the specified query (queries) to be sent to the indicated
74 host(s) immediately.
75 Otherwise,
76 @code{ntpq}
77 will attempt to read
78 interactive format commands from the standard input.
79 @subsubsection Internal Commands
80 Interactive format commands consist of a keyword followed by zero
81 to four arguments.
82 Only enough characters of the full keyword to
83 uniquely identify the command need be typed.
84
85 A
86 number of interactive format commands are executed entirely within
87 the
88 @code{ntpq}
89 utility itself and do not result in NTP mode 6
90 requests being sent to a server.
91 These are described following.
92 @table @asis
93 @item @code{?} @code{[@kbd{command_keyword}]}
94 @item @code{help} @code{[@kbd{command_keyword}]}
95 A
96 @quoteleft{}?@quoteright{}
97 by itself will print a list of all the command
98 keywords known to this incarnation of
99 @code{ntpq}
100 A
101 @quoteleft{}?@quoteright{}
102 followed by a command keyword will print function and usage
103 information about the command.
104 This command is probably a better
105 source of information about
106 @code{ntpq}
107 than this manual
108 page.
109 @item @code{addvars} @kbd{variable_name}@code{[@code{=value}]} @code{...}
110 @item @code{rmvars} @kbd{variable_name} @code{...}
111 @item @code{clearvars}
112 @item @code{showvars}
113 The data carried by NTP mode 6 messages consists of a list of
114 items of the form
115 @quoteleft{}variable_name=value@quoteright{},
116 where the
117 @quoteleft{}=value@quoteright{}
118 is ignored, and can be omitted,
119 in requests to the server to read variables.
120 The
121 @code{ntpq}
122 utility maintains an internal list in which data to be included in control
123 messages can be assembled, and sent using the
124 @code{readlist}
125 and
126 @code{writelist}
127 commands described below.
128 The
129 @code{addvars}
130 command allows variables and their optional values to be added to
131 the list.
132 If more than one variable is to be added, the list should
133 be comma-separated and not contain white space.
134 The
135 @code{rmvars}
136 command can be used to remove individual variables from the list,
137 while the
138 @code{clearlist}
139 command removes all variables from the
140 list.
141 The
142 @code{showvars}
143 command displays the current list of optional variables.
144 @item @code{authenticate} @code{[yes | no]}
145 Normally
146 @code{ntpq}
147 does not authenticate requests unless
148 they are write requests.
149 The command
150 @quoteleft{}authenticate yes@quoteright{}
151 causes
152 @code{ntpq}
153 to send authentication with all requests it
154 makes.
155 Authenticated requests causes some servers to handle
156 requests slightly differently, and can occasionally melt the CPU in
157 fuzzballs if you turn authentication on before doing a
158 @code{peer}
159 display.
160 The command
161 @quoteleft{}authenticate@quoteright{}
162 causes
163 @code{ntpq}
164 to display whether or not
165 @code{ntpq}
166 is currently autheinticating requests.
167 @item @code{cooked}
168 Causes output from query commands to be "cooked", so that
169 variables which are recognized by
170 @code{ntpq}
171 will have their
172 values reformatted for human consumption.
173 Variables which
174 @code{ntpq}
175 thinks should have a decodable value but didn't are
176 marked with a trailing
177 @quoteleft{}?@quoteright{}.
178 @item @code{debug} @code{[@code{more} | @code{less} | @code{off}]}
179 With no argument, displays the current debug level.
180 Otherwise, the debug level is changed to the indicated level.
181 @item @code{delay} @kbd{milliseconds}
182 Specify a time interval to be added to timestamps included in
183 requests which require authentication.
184 This is used to enable
185 (unreliable) server reconfiguration over long delay network paths
186 or between machines whose clocks are unsynchronized.
187 Actually the
188 server does not now require timestamps in authenticated requests,
189 so this command may be obsolete.
190 @item @code{exit}
191 Exit
192 @code{ntpq}
193 @item @code{host} @kbd{hostname}
194 Set the host to which future queries will be sent.
195 @kbd{hostname}
196 may be either a host name or a numeric address.
197 @item @code{hostnames} @code{[@code{yes} | @code{no}]}
198 If
199 @code{yes}
200 is specified, host names are printed in
201 information displays.
202 If
203 @code{no}
204 is specified, numeric
205 addresses are printed instead.
206 The default is
207 @code{yes},
208 unless
209 modified using the command line
210 @code{-n}
211 switch.
212 @item @code{keyid} @kbd{keyid}
213 This command allows the specification of a key number to be
214 used to authenticate configuration requests.
215 This must correspond
216 to a key number the server has been configured to use for this
217 purpose.
218 @item @code{keytype} @code{[@code{md5} | @code{OpenSSLDigestType}]}
219 Specify the type of key to use for authenticating requests.
220 @code{md5}
221 is alway supported.
222 If
223 @code{ntpq}
224 was built with OpenSSL support,
225 any digest type supported by OpenSSL can also be provided.
226 If no argument is given, the current
227 @code{keytype}
228 is displayed.
229 @item @code{ntpversion} @code{[@code{1} | @code{2} | @code{3} | @code{4}]}
230 Sets the NTP version number which
231 @code{ntpq}
232 claims in
233 packets.
234 Defaults to 3, and note that mode 6 control messages (and
235 modes, for that matter) didn't exist in NTP version 1.
236 There appear
237 to be no servers left which demand version 1.
238 With no argument, displays the current NTP version that will be used
239 when communicating with servers.
240 @item @code{passwd}
241 This command prompts you to type in a password (which will not
242 be echoed) which will be used to authenticate configuration
243 requests.
244 The password must correspond to the key configured for
245 use by the NTP server for this purpose if such requests are to be
246 successful.
247 @code{poll}
248 @kbd{n}
249 @code{verbose}
250 @item @code{quit}
251 Exit
252 @code{ntpq}
253 @item @code{raw}
254 Causes all output from query commands is printed as received
255 from the remote server.
256 The only formating/interpretation done on
257 the data is to transform nonascii data into a printable (but barely
258 understandable) form.
259 @item @code{timeout} @kbd{milliseconds}
260 Specify a timeout period for responses to server queries.
261 The
262 default is about 5000 milliseconds.
263 Note that since
264 @code{ntpq}
265 retries each query once after a timeout, the total waiting time for
266 a timeout will be twice the timeout value set.
267 @item @code{version}
268 Print the version of the
269 @code{ntpq}
270 program.
271 @end table
272
273 @subsubsection Control Message Commands
274 Association IDs are used to identify system, peer and clock variables.
275 System variables are assigned an association ID of zero and system name space, while each association is assigned a nonzero association ID and peer namespace.
276 Most control commands send a single mode-6 message to the server and expect a single response message.
277 The exceptions are the
278 @code{peers}
279 command, which sends a series of messages,
280 and the
281 @code{mreadlist}
282 and
283 @code{mreadvar}
284 commands, which iterate over a range of associations.
285 @table @asis
286 @item @code{associations}
287 Display a list of mobilized associations in the form:
288 @example
289 ind assid status conf reach auth condition last_event cnt
290 @end example
291 @table @asis
292 @item Sy String Ta Sy Description
293 @item @code{ind} @code{Ta} @code{index} @code{on} @code{this} @code{list}
294 @item @code{assid} @code{Ta} @code{association} @code{ID}
295 @item @code{status} @code{Ta} @code{peer} @code{status} @code{word}
296 @item @code{conf} @code{Ta} @code{yes}: @code{persistent,} @code{no}: @code{ephemeral}
297 @item @code{reach} @code{Ta} @code{yes}: @code{reachable,} @code{no}: @code{unreachable}
298 @item @code{auth} @code{Ta} @code{ok}, @code{yes}, @code{bad} @code{and} @code{none}
299 @item @code{condition} @code{Ta} @code{selection} @code{status} @code{(see} @code{the} @code{select} @code{field} @code{of} @code{the} @code{peer} @code{status} @code{word)}
300 @item @code{last_event} @code{Ta} @code{event} @code{report} @code{(see} @code{the} @code{event} @code{field} @code{of} @code{the} @code{peer} @code{status} @code{word)}
301 @item @code{cnt} @code{Ta} @code{event} @code{count} @code{(see} @code{the} @code{count} @code{field} @code{of} @code{the} @code{peer} @code{status} @code{word)}
302 @end table
303 @item @code{authinfo}
304 Display the authentication statistics.
305 @item @code{clockvar} @kbd{assocID} @code{[@kbd{name}@code{[@code{=}@kbd{value}]}]} @code{[...]}
306 @item @code{cv} @kbd{assocID} @code{[@kbd{name}@code{[@code{=}@kbd{value}]}]} @code{[...]}
307 Display a list of clock variables for those associations supporting a reference clock.
308 @item @code{:config} @code{[...]}
309 Send the remainder of the command line, including whitespace, to the server as a run-time configuration command in the same format as a line in the configuration file. This command is experimental until further notice and clarification. Authentication is of course required.
310 @item @code{config-from-file} @kbd{filename}
311 Send the each line of
312 @kbd{filename}
313 to the server as run-time configuration commands in the same format as a line in the configuration file. This command is experimental until further notice and clarification. Authentication is required.
314 @item @code{ifstats}
315 Display statistics for each local network address. Authentication is required.
316 @item @code{iostats}
317 Display network and reference clock I/O statistics.
318 @item @code{kerninfo}
319 Display kernel loop and PPS statistics. As with other ntpq output, times are in milliseconds. The precision value displayed is in milliseconds as well, unlike the precision system variable.
320 @item @code{lassociations}
321 Perform the same function as the associations command, except display mobilized and unmobilized associations.
322 @item @code{lopeers} @code{[@code{-4} | @code{-6}]}
323 Obtain and print a list of all peers and clients showing
324 @kbd{dstadr}
325 (associated with any given IP version).
326 @item @code{lpeers} @code{[@code{-4} | @code{-6}]}
327 Print a peer spreadsheet for the appropriate IP version(s).
328 @kbd{dstadr}
329 (associated with any given IP version).
330 @item @code{monstats}
331 Display monitor facility statistics.
332 @item @code{mrulist} @code{[@code{limited} | @code{kod} | @code{mincount}=@kbd{count} | @code{laddr}=@kbd{localaddr} | @code{sort}=@kbd{sortorder} | @code{resany}=@kbd{hexmask} | @code{resall}=@kbd{hexmask}]}
333 Obtain and print traffic counts collected and maintained by the monitor facility.
334 With the exception of
335 @code{sort}=@kbd{sortorder},
336 the options filter the list returned by
337 @code{ntpd.}
338 The
339 @code{limited}
340 and
341 @code{kod}
342 options return only entries representing client addresses from which the last packet received triggered either discarding or a KoD response.
343 The
344 @code{mincount}=@kbd{count}
345 option filters entries representing less than
346 @kbd{count}
347 packets.
348 The
349 @code{laddr}=@kbd{localaddr}
350 option filters entries for packets received on any local address other than
351 @kbd{localaddr}.
352 @code{resany}=@kbd{hexmask}
353 and
354 @code{resall}=@kbd{hexmask}
355 filter entries containing none or less than all, respectively, of the bits in
356 @kbd{hexmask},
357 which must begin with
358 @code{0x}.
359 The
360 @kbd{sortorder}
361 defaults to
362 @code{lstint}
363 and may be any of
364 @code{addr},
365 @code{count},
366 @code{avgint},
367 @code{lstint},
368 or any of those preceded by a minus sign (hyphen) to reverse the sort order.
369 The output columns are:
370 @table @asis
371 @item Column
372 Description
373 @item @code{lstint}
374 Interval in s between the receipt of the most recent packet from this address and the completion of the retrieval of the MRU list by
375 @code{ntpq}
376 @item @code{avgint}
377 Average interval in s between packets from this address.
378 @item @code{rstr}
379 Restriction flags associated with this address.
380 Most are copied unchanged from the matching
381 @code{restrict}
382 command, however 0x400 (kod) and 0x20 (limited) flags are cleared unless the last packet from this address triggered a rate control response.
383 @item @code{r}
384 Rate control indicator, either
385 a period,
386 @code{L}
387 or
388 @code{K}
389 for no rate control response,
390 rate limiting by discarding, or rate limiting with a KoD response, respectively.
391 @item @code{m}
392 Packet mode.
393 @item @code{v}
394 Packet version number.
395 @item @code{count}
396 Packets received from this address.
397 @item @code{rport}
398 Source port of last packet from this address.
399 @item @code{remote} @code{address}
400 DNS name, numeric address, or address followed by
401 claimed DNS name which could not be verified in parentheses.
402 @end table
403 @item @code{mreadvar} @code{assocID} @code{assocID} @code{[@kbd{variable_name}@code{[=@kbd{value}]} ...]}
404 @item @code{mrv} @code{assocID} @code{assocID} @code{[@kbd{variable_name}@code{[=@kbd{value}]} ...]}
405 Perform the same function as the
406 @code{readvar}
407 command, except for a range of association IDs.
408 This range is determined from the association list cached by the most recent
409 @code{associations}
410 command.
411 @item @code{opeers} @code{[@code{-4} | @code{-6}]}
412 Obtain and print the old-style list of all peers and clients showing
413 @kbd{dstadr}
414 (associated with any given IP version),
415 rather than the
416 @kbd{refid}.
417 @item @code{passociations}
418 Perform the same function as the
419 @code{associations}
420 command,
421 except that it uses previously stored data rather than making a new query.
422 @item @code{peers}
423 Display a list of peers in the form:
424 @example
425 [tally]remote refid st t when pool reach delay offset jitter
426 @end example
427 @table @asis
428 @item Variable
429 Description
430 @item @code{[tally]}
431 single-character code indicating current value of the
432 @code{select}
433 field of the
434 .Lk decode.html#peer "peer status word"
435 @item @code{remote}
436 host name (or IP number) of peer.
437 The value displayed will be truncated to 15 characters  unless the
438 @code{-w}
439 flag is given, in which case the full value will be displayed
440 on the first line,
441 and the remaining data is displayed on the next line.
442 @item @code{refid}
443 association ID or
444 .Lk decode.html#kiss "'kiss code"
445 @item @code{st}
446 stratum
447 @item @code{t}
448 @code{u}:
449 unicast or manycast client,
450 @code{b}:
451 broadcast or multicast client,
452 @code{l}:
453 local (reference clock),
454 @code{s}:
455 symmetric (peer),
456 @code{A}:
457 manycast server,
458 @code{B}:
459 broadcast server,
460 @code{M}:
461 multicast server
462 @item @code{when}
463 sec/min/hr since last received packet
464 @item @code{poll}
465 poll interval (log2 s)
466 @item @code{reach}
467 reach shift register (octal)
468 @item @code{delay}
469 roundtrip delay
470 @item @code{offset}
471 offset of server relative to this host
472 @item @code{jitter}
473 jitter
474 @end table
475 @item @code{pstats} @kbd{assocID}
476 Show the statistics for the peer with the given
477 @kbd{assocID}.
478 @item @code{readlist} @kbd{assocID}
479 @item @code{rl} @kbd{assocID}
480 Read the system or peer variables included in the variable list.
481 @item @code{readvar} @kbd{assocID} @kbd{name}@code{[=@kbd{value}]} @code{[, ...]}
482 @item @code{rv} @kbd{assocID} @kbd{name}@code{[=@kbd{value}]} @code{[, ...]}
483 Display the specified variables.
484 If
485 @kbd{assocID}
486 is zero, the variables are from the
487 @ref{System Variables}
488 name space, otherwise they are from the
489 @ref{Peer Variables}
490 name space.
491 The
492 @kbd{assocID}
493 is required, as the same name can occur in both spaces.
494 If no
495 @kbd{name}
496 is included, all operative variables in the name space are displayed.
497
498 In this case only, if the
499 @kbd{assocID}
500 is omitted, it is assumed zero.
501 Multiple names are specified with comma separators and without whitespace.
502 Note that time values are represented in milliseconds
503 and frequency values in parts-per-million (PPM).
504 Some NTP timestamps are represented in the format
505 YYYYMMDDTTTT ,
506 where YYYY is the year,
507 MM the month of year,
508 DD the day of month and
509 TTTT the time of day.
510 @item @code{reslist}
511 Show the access control (restrict) list for
512 @code{ntpq}
513
514 @item @code{saveconfig} @kbd{filename}
515 Write the current configuration,
516 including any runtime modifications given with
517 @code{:config}
518 or
519 @code{config-from-file},
520 to the ntpd host's file
521 @kbd{filename}.
522 This command will be rejected by the server unless
523 .Lk miscopt.html#saveconfigdir "saveconfigdir"
524 appears in the
525 @code{ntpd}
526 configuration file.
527 @kbd{filename}
528 can use
529 @code{strftime()}
530 format specifies to substitute the current date and time, for example,
531 @code{q]saveconfig} @code{ntp-%Y%m%d-%H%M%S.confq]}.
532 The filename used is stored in system variable
533 @code{savedconfig}.
534 Authentication is required.
535 @item @code{timerstats}
536 Display interval timer counters.
537 @item @code{writelist} @kbd{assocID}
538 Write the system or peer variables included in the variable list.
539 @item @code{writevar} @kbd{assocID} @kbd{name}=@kbd{value} @code{[, ...]}
540 Write the specified variables.
541 If the
542 @kbd{assocID}
543 is zero, the variables are from the
544 @ref{System Variables}
545 name space, otherwise they are from the
546 @ref{Peer Variables}
547 name space.
548 The
549 @kbd{assocID}
550 is required, as the same name can occur in both spaces.
551 @item @code{sysinfo}
552 Display operational summary.
553 @item @code{sysstats}
554 Print statistics counters maintained in the protocol module.
555 @end table
556
557 @subsubsection Status Words and Kiss Codes
558
559 The current state of the operating program is shown
560 in a set of status words
561 maintained by the system.
562 Status information is also available on a per-association basis.
563 These words are displayed in the
564 @code{rv}
565 and
566 @code{as}
567 commands both in hexadecimal and in decoded short tip strings.
568 The codes, tips and short explanations are documented on the
569 .Lk decode.html "Event Messages and Status Words"
570 page.
571 The page also includes a list of system and peer messages,
572 the code for the latest of which is included in the status word.
573
574 Information resulting from protocol machine state transitions
575 is displayed using an informal set of ASCII strings called
576 .Lk decode.html#kiss "kiss codes" .
577 The original purpose was for kiss-o'-death (KoD) packets
578 sent by the server to advise the client of an unusual condition.
579 They are now displayed, when appropriate,
580 in the reference identifier field in various billboards.
581
582 @subsubsection System Variables
583 The following system variables appear in the
584 @code{rv}
585 billboard.
586 Not all variables are displayed in some configurations.
587 @table @asis
588 @item Variable
589 Description
590 @item @code{status}
591 .Lk decode.html#sys "system status word"
592 @item @code{version}
593 NTP software version and build time
594 @item @code{processor}
595 hardware platform and version
596 @item @code{system}
597 operating system and version
598 @item @code{leap}
599 leap warning indicator (0-3)
600 @item @code{stratum}
601 stratum (1-15)
602 @item @code{precision}
603 precision (log2 s)
604 @item @code{rootdelay}
605 total roundtrip delay to the primary reference clock
606 @item @code{rootdisp}
607 total dispersion to the primary reference clock
608 @item @code{peer}
609 system peer association ID
610 @item @code{tc}
611 time constant and poll exponent (log2 s) (3-17)
612 @item @code{mintc}
613 minimum time constant (log2 s) (3-10)
614 @item @code{clock}
615 date and time of day
616 @item @code{refid}
617 reference ID or
618 .Lk decode.html#kiss "kiss code"
619 @item @code{reftime}
620 reference time
621 @item @code{offset}
622 combined  offset of server relative to this host
623 @item @code{sys_jitter}
624 combined system jitter
625 @item @code{frequency}
626 frequency offset (PPM) relative to hardware clock
627 @item @code{clk_wander}
628 clock frequency wander (PPM)
629 @item @code{clk_jitter}
630 clock jitter
631 @item @code{tai}
632 TAI-UTC offset (s)
633 @item @code{leapsec}
634 NTP seconds when the next leap second is/was inserted
635 @item @code{expire}
636 NTP seconds when the NIST leapseconds file expires
637 @end table
638 The jitter and wander statistics are exponentially-weighted RMS averages.
639 The system jitter is defined in the NTPv4 specification;
640 the clock jitter statistic is computed by the clock discipline module.
641
642 When the NTPv4 daemon is compiled with the OpenSSL software library,
643 additional system variables are displayed,
644 including some or all of the following,
645 depending on the particular Autokey dance:
646
647 @table @asis
648 @item Variable
649 Description
650 @item @code{host}
651 Autokey host name for this host
652 @item @code{ident}
653 Autokey group name for this host
654 @item @code{flags}
655 host flags  (see Autokey specification)
656 @item @code{digest}
657 OpenSSL message digest algorithm
658 @item @code{signature}
659 OpenSSL digest/signature scheme
660 @item @code{update}
661 NTP seconds at last signature update
662 @item @code{cert}
663 certificate subject, issuer and certificate flags
664 @item @code{until}
665 NTP seconds when the certificate expires
666 @end table
667 @subsubsection Peer Variables
668 The following peer variables appear in the
669 @code{rv}
670 billboard for each association.
671 Not all variables are displayed in some configurations.
672
673 @table @asis
674 @item Variable
675 Description
676 @item @code{associd}
677 association ID
678 @item @code{status}
679 .Lk decode.html#peer "peer status word"
680 @item @code{srcadr}
681 source (remote) IP address
682 @item @code{srcport}
683 source (remote) port
684 @item @code{dstadr}
685 destination (local) IP address
686 @item @code{dstport}
687 destination (local) port
688 @item @code{leap}
689 leap indicator (0-3)
690 @item @code{stratum}
691 stratum (0-15)
692 @item @code{precision}
693 precision (log2 s)
694 @item @code{rootdelay}
695 total roundtrip delay to the primary reference clock
696 @item @code{rootdisp}
697 total root dispersion to the primary reference clock
698 @item @code{refid}
699 reference ID or
700 .Lk decode.html#kiss "kiss code"
701 @item @code{reftime}
702 reference time
703 @item @code{reach}
704 reach register (octal)
705 @item @code{unreach}
706 unreach counter
707 @item @code{hmode}
708 host mode (1-6)
709 @item @code{pmode}
710 peer mode (1-5)
711 @item @code{hpoll}
712 host poll exponent (log2 s) (3-17)
713 @item @code{ppoll}
714 peer poll exponent (log2 s) (3-17)
715 @item @code{headway}
716 headway (see
717 .Lk rate.html "Rate Management and the Kiss-o'-Death Packet" )
718 @item @code{flash}
719 .Lk decode.html#flash "flash status word"
720 @item @code{offset}
721 filter offset
722 @item @code{delay}
723 filter delay
724 @item @code{dispersion}
725 filter dispersion
726 @item @code{jitter}
727 filter jitter
728 @item @code{ident}
729 Autokey group name for this association
730 @item @code{bias}
731 unicast/broadcast bias
732 @item @code{xleave}
733 interleave delay (see
734 .Lk xleave.html "NTP Interleaved Modes" )
735 @end table
736 The
737 @code{bias}
738 variable is calculated when the first broadcast packet is received
739 after the calibration volley.
740 It represents the offset of the broadcast subgraph relative to the unicast subgraph.
741 The
742 @code{xleave}
743 variable appears only for the interleaved symmetric and interleaved modes.
744 It represents the internal queuing, buffering and transmission delays
745 for the preceding packet.
746
747 When the NTPv4 daemon is compiled with the OpenSSL software library,
748 additional peer variables are displayed, including the following:
749 @table @asis
750 @item Variable
751 Description
752 @item @code{flags}
753 peer flags (see Autokey specification)
754 @item @code{host}
755 Autokey server name
756 @item @code{flags}
757 peer flags (see Autokey specification)
758 @item @code{signature}
759 OpenSSL digest/signature scheme
760 @item @code{initsequence}
761 initial key ID
762 @item @code{initkey}
763 initial key index
764 @item @code{timestamp}
765 Autokey signature timestamp
766 @end table
767
768 @subsubsection Clock Variables
769 The following clock variables appear in the
770 @code{cv}
771 billboard for each association with a reference clock.
772 Not all variables are displayed in some configurations.
773 @table @asis
774 @item Variable
775 Description
776 @item @code{associd}
777 association ID
778 @item @code{status}
779 .Lk decode.html#clock "clock status word"
780 @item @code{device}
781 device description
782 @item @code{timecode}
783 ASCII time code string (specific to device)
784 @item @code{poll}
785 poll messages sent
786 @item @code{noreply}
787 no reply
788 @item @code{badformat}
789 bad format
790 @item @code{baddata}
791 bad date or time
792 @item @code{fudgetime1}
793 fudge time 1
794 @item @code{fudgetime2}
795 fudge time 2
796 @item @code{stratum}
797 driver stratum
798 @item @code{refid}
799 driver reference ID
800 @item @code{flags}
801 driver flags
802 @end table
803
804 This section was generated by @strong{AutoGen},
805 using the @code{agtexi-cmd} template and the option descriptions for the @code{ntpq} program.
806 This software is released under the NTP license, <http://ntp.org/license>.
807
808 @menu
809 * ntpq usage::                  ntpq help/usage (@option{--help})
810 * ntpq ipv4::                   ipv4 option (-4)
811 * ntpq ipv6::                   ipv6 option (-6)
812 * ntpq command::                command option (-c)
813 * ntpq interactive::            interactive option (-i)
814 * ntpq numeric::                numeric option (-n)
815 * ntpq old-rv::                 old-rv option
816 * ntpq peers::                  peers option (-p)
817 * ntpq wide::                   wide option (-w)
818 * ntpq config::                 presetting/configuring ntpq
819 * ntpq exit status::            exit status
820 @end menu
821
822 @node ntpq usage
823 @subsection ntpq help/usage (@option{--help})
824 @cindex ntpq help
825
826 This is the automatically generated usage text for ntpq.
827
828 The text printed is the same whether selected with the @code{help} option
829 (@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
830 the usage text by passing it through a pager program.
831 @code{more-help} is disabled on platforms without a working
832 @code{fork(2)} function.  The @code{PAGER} environment variable is
833 used to select the program, defaulting to @file{more}.  Both will exit
834 with a status code of 0.
835
836 @exampleindent 0
837 @example
838 ntpq - standard NTP query program - Ver. 4.2.8p2
839 Usage:  ntpq [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
840   Flg Arg Option-Name    Description
841    -4 no  ipv4           Force IPv4 DNS name resolution
842                                 - prohibits the option 'ipv6'
843    -6 no  ipv6           Force IPv6 DNS name resolution
844                                 - prohibits the option 'ipv4'
845    -c Str command        run a command and exit
846                                 - may appear multiple times
847    -d no  debug-level    Increase debug verbosity level
848                                 - may appear multiple times
849    -D Num set-debug-level Set the debug verbosity level
850                                 - may appear multiple times
851    -i no  interactive    Force ntpq to operate in interactive mode
852                                 - prohibits these options:
853                                 command
854                                 peers
855    -n no  numeric        numeric host addresses
856       no  old-rv         Always output status line with readvar
857    -p no  peers          Print a list of the peers
858                                 - prohibits the option 'interactive'
859    -w no  wide           Display the full 'remote' value
860       opt version        output version information and exit
861    -? no  help           display extended usage information and exit
862    -! no  more-help      extended usage information passed thru pager
863    -> opt save-opts      save the option state to a config file
864    -< Str load-opts      load options from a config file
865                                 - disabled as '--no-load-opts'
866                                 - may appear multiple times
867
868 Options are specified by doubled hyphens and their name or by a single
869 hyphen and the flag character.
870
871 The following option preset mechanisms are supported:
872  - reading file $HOME/.ntprc
873  - reading file ./.ntprc
874  - examining environment variables named NTPQ_*
875
876 Please send bug reports to:  <http://bugs.ntp.org, bugs@@ntp.org>
877 @end example
878 @exampleindent 4
879
880 @node ntpq ipv4
881 @subsection ipv4 option (-4)
882 @cindex ntpq-ipv4
883
884 This is the ``force ipv4 dns name resolution'' option.
885
886 @noindent
887 This option has some usage constraints.  It:
888 @itemize @bullet
889 @item
890 must not appear in combination with any of the following options:
891 ipv6.
892 @end itemize
893
894 Force DNS resolution of following host names on the command line
895 to the IPv4 namespace.
896 @node ntpq ipv6
897 @subsection ipv6 option (-6)
898 @cindex ntpq-ipv6
899
900 This is the ``force ipv6 dns name resolution'' option.
901
902 @noindent
903 This option has some usage constraints.  It:
904 @itemize @bullet
905 @item
906 must not appear in combination with any of the following options:
907 ipv4.
908 @end itemize
909
910 Force DNS resolution of following host names on the command line
911 to the IPv6 namespace.
912 @node ntpq command
913 @subsection command option (-c)
914 @cindex ntpq-command
915
916 This is the ``run a command and exit'' option.
917 This option takes a string argument @file{cmd}.
918
919 @noindent
920 This option has some usage constraints.  It:
921 @itemize @bullet
922 @item
923 may appear an unlimited number of times.
924 @end itemize
925
926 The following argument is interpreted as an interactive format command
927 and is added to the list of commands to be executed on the specified
928 host(s).
929 @node ntpq interactive
930 @subsection interactive option (-i)
931 @cindex ntpq-interactive
932
933 This is the ``force ntpq to operate in interactive mode'' option.
934
935 @noindent
936 This option has some usage constraints.  It:
937 @itemize @bullet
938 @item
939 must not appear in combination with any of the following options:
940 command, peers.
941 @end itemize
942
943 Force @code{ntpq} to operate in interactive mode.
944 Prompts will be written to the standard output and
945 commands read from the standard input.
946 @node ntpq numeric
947 @subsection numeric option (-n)
948 @cindex ntpq-numeric
949
950 This is the ``numeric host addresses'' option.
951 Output all host addresses in dotted-quad numeric format rather than
952 converting to the canonical host names. 
953 @node ntpq old-rv
954 @subsection old-rv option
955 @cindex ntpq-old-rv
956
957 This is the ``always output status line with readvar'' option.
958 By default, @code{ntpq} now suppresses the @code{associd=...}
959 line that precedes the output of @code{readvar}
960 (alias @code{rv}) when a single variable is requested, such as
961 @code{ntpq -c "rv 0 offset"}.
962 This option causes @code{ntpq} to include both lines of output
963 for a single-variable @code{readvar}.
964 Using an environment variable to
965 preset this option in a script will enable both older and
966 newer @code{ntpq} to behave identically in this regard.
967 @node ntpq peers
968 @subsection peers option (-p)
969 @cindex ntpq-peers
970
971 This is the ``print a list of the peers'' option.
972
973 @noindent
974 This option has some usage constraints.  It:
975 @itemize @bullet
976 @item
977 must not appear in combination with any of the following options:
978 interactive.
979 @end itemize
980
981 Print a list of the peers known to the server as well as a summary
982 of their state. This is equivalent to the 'peers' interactive command.
983 @node ntpq wide
984 @subsection wide option (-w)
985 @cindex ntpq-wide
986
987 This is the ``display the full 'remote' value'' option.
988 Display the full value of the 'remote' value.  If this requires
989 more than 15 characters, display the full value, emit a newline,
990 and continue the data display properly indented on the next line.
991
992
993 @node ntpq config
994 @subsection presetting/configuring ntpq
995
996 Any option that is not marked as @i{not presettable} may be preset by
997 loading values from configuration ("rc" or "ini") files, and values from environment variables named @code{NTPQ} and @code{NTPQ_<OPTION_NAME>}.  @code{<OPTION_NAME>} must be one of
998 the options listed above in upper case and segmented with underscores.
999 The @code{NTPQ} variable will be tokenized and parsed like
1000 the command line.  The remaining variables are tested for existence and their
1001 values are treated like option arguments.
1002
1003
1004 @noindent
1005 @code{libopts} will search in 2 places for configuration files:
1006 @itemize @bullet
1007 @item
1008 $HOME
1009 @item
1010 $PWD
1011 @end itemize
1012 The environment variables @code{HOME}, and @code{PWD}
1013 are expanded and replaced when @file{ntpq} runs.
1014 For any of these that are plain files, they are simply processed.
1015 For any that are directories, then a file named @file{.ntprc} is searched for
1016 within that directory and processed.
1017
1018 Configuration files may be in a wide variety of formats.
1019 The basic format is an option name followed by a value (argument) on the
1020 same line.  Values may be separated from the option name with a colon,
1021 equal sign or simply white space.  Values may be continued across multiple
1022 lines by escaping the newline with a backslash.
1023
1024 Multiple programs may also share the same initialization file.
1025 Common options are collected at the top, followed by program specific
1026 segments.  The segments are separated by lines like:
1027 @example
1028 [NTPQ]
1029 @end example
1030 @noindent
1031 or by
1032 @example
1033 <?program ntpq>
1034 @end example
1035 @noindent
1036 Do not mix these styles within one configuration file.
1037
1038 Compound values and carefully constructed string values may also be
1039 specified using XML syntax:
1040 @example
1041 <option-name>
1042    <sub-opt>...&lt;...&gt;...</sub-opt>
1043 </option-name>
1044 @end example
1045 @noindent
1046 yielding an @code{option-name.sub-opt} string value of
1047 @example
1048 "...<...>..."
1049 @end example
1050 @code{AutoOpts} does not track suboptions.  You simply note that it is a
1051 hierarchicly valued option.  @code{AutoOpts} does provide a means for searching
1052 the associated name/value pair list (see: optionFindValue).
1053
1054 The command line options relating to configuration and/or usage help are:
1055
1056 @subsubheading version (-)
1057
1058 Print the program version to standard out, optionally with licensing
1059 information, then exit 0.  The optional argument specifies how much licensing
1060 detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument.
1061 Only the first letter of the argument is examined:
1062
1063 @table @samp
1064 @item version
1065 Only print the version.  This is the default.
1066 @item copyright
1067 Name the copyright usage licensing terms.
1068 @item verbose
1069 Print the full copyright usage licensing terms.
1070 @end table
1071
1072 @node ntpq exit status
1073 @subsection ntpq exit status
1074
1075 One of the following exit values will be returned:
1076 @table @samp
1077 @item 0 (EXIT_SUCCESS)
1078 Successful program execution.
1079 @item 1 (EXIT_FAILURE)
1080 The operation failed or the command syntax was not valid.
1081 @item 66 (EX_NOINPUT)
1082 A specified configuration file could not be loaded.
1083 @item 70 (EX_SOFTWARE)
1084 libopts had an internal operational error.  Please report
1085 it to autogen-users@@lists.sourceforge.net.  Thank you.
1086 @end table