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