aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpq/invoke-ntpq.texi
blob: 28cf6c9821e6b39e8a8dd0bf82259524707dd655 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
@node ntpq Invocation
@section Invoking ntpq
@pindex ntpq
@cindex standard NTP query program
@ignore
#
# EDIT THIS FILE WITH CAUTION  (invoke-ntpq.texi)
#
# It has been AutoGen-ed  June  2, 2016 at 07:37:46 AM by AutoGen 5.18.5
# From the definitions    ntpq-opts.def
# and the template file   agtexi-cmd.tpl
@end ignore


The
@code{ntpq}
utility program is used to query NTP servers which
implement the standard NTP mode 6 control message formats defined
in Appendix B of the NTPv3 specification RFC1305, requesting
information about current state and/or changes in that state.
The same formats are used in NTPv4, although some of the
variables have changed and new ones added. The description on this
page is for the NTPv4 variables.
The program may be run either in interactive mode or controlled using
command line arguments.
Requests to read and write arbitrary
variables can be assembled, with raw and pretty-printed output
options being available.
The
@code{ntpq}
utility can also obtain and print a
list of peers in a common format by sending multiple queries to the
server.

If one or more request options is included on the command line
when
@code{ntpq}
is executed, each of the requests will be sent
to the NTP servers running on each of the hosts given as command
line arguments, or on localhost by default.
If no request options
are given,
@code{ntpq}
will attempt to read commands from the
standard input and execute these on the NTP server running on the
first host given on the command line, again defaulting to localhost
when no other host is specified.
The
@code{ntpq}
utility will prompt for
commands if the standard input is a terminal device.

@code{ntpq}
uses NTP mode 6 packets to communicate with the
NTP server, and hence can be used to query any compatible server on
the network which permits it.
Note that since NTP is a UDP protocol
this communication will be somewhat unreliable, especially over
large distances in terms of network topology.
The
@code{ntpq}
utility makes
one attempt to retransmit requests, and will time requests out if
the remote host is not heard from within a suitable timeout
time.

Specifying a
command line option other than
@code{-i}
or
@code{-n}
will
cause the specified query (queries) to be sent to the indicated
host(s) immediately.
Otherwise,
@code{ntpq}
will attempt to read
interactive format commands from the standard input.
@subsubsection Internal Commands
Interactive format commands consist of a keyword followed by zero
to four arguments.
Only enough characters of the full keyword to
uniquely identify the command need be typed.

A
number of interactive format commands are executed entirely within
the
@code{ntpq}
utility itself and do not result in NTP mode 6
requests being sent to a server.
These are described following.
@table @asis
@item @code{?} @code{[@kbd{command_keyword}]}
@item @code{help} @code{[@kbd{command_keyword}]}
A
@quoteleft{}?@quoteright{}
by itself will print a list of all the command
keywords known to this incarnation of
@code{ntpq}
A
@quoteleft{}?@quoteright{}
followed by a command keyword will print function and usage
information about the command.
This command is probably a better
source of information about
@code{ntpq}
than this manual
page.
@item @code{addvars} @kbd{variable_name}@code{[@code{=value}]} @code{...}
@item @code{rmvars} @kbd{variable_name} @code{...}
@item @code{clearvars}
@item @code{showvars}
The data carried by NTP mode 6 messages consists of a list of
items of the form
@quoteleft{}variable_name=value@quoteright{},
where the
@quoteleft{}=value@quoteright{}
is ignored, and can be omitted,
in requests to the server to read variables.
The
@code{ntpq}
utility maintains an internal list in which data to be included in control
messages can be assembled, and sent using the
@code{readlist}
and
@code{writelist}
commands described below.
The
@code{addvars}
command allows variables and their optional values to be added to
the list.
If more than one variable is to be added, the list should
be comma-separated and not contain white space.
The
@code{rmvars}
command can be used to remove individual variables from the list,
while the
@code{clearlist}
command removes all variables from the
list.
The
@code{showvars}
command displays the current list of optional variables.
@item @code{authenticate} @code{[yes | no]}
Normally
@code{ntpq}
does not authenticate requests unless
they are write requests.
The command
@quoteleft{}authenticate yes@quoteright{}
causes
@code{ntpq}
to send authentication with all requests it
makes.
Authenticated requests causes some servers to handle
requests slightly differently, and can occasionally melt the CPU in
fuzzballs if you turn authentication on before doing a
@code{peer}
display.
The command
@quoteleft{}authenticate@quoteright{}
causes
@code{ntpq}
to display whether or not
@code{ntpq}
is currently autheinticating requests.
@item @code{cooked}
Causes output from query commands to be "cooked", so that
variables which are recognized by
@code{ntpq}
will have their
values reformatted for human consumption.
Variables which
@code{ntpq}
thinks should have a decodable value but didn't are
marked with a trailing
@quoteleft{}?@quoteright{}.
@item @code{debug} @code{[@code{more} | @code{less} | @code{off}]}
With no argument, displays the current debug level.
Otherwise, the debug level is changed to the indicated level.
@item @code{delay} @kbd{milliseconds}
Specify a time interval to be added to timestamps included in
requests which require authentication.
This is used to enable
(unreliable) server reconfiguration over long delay network paths
or between machines whose clocks are unsynchronized.
Actually the
server does not now require timestamps in authenticated requests,
so this command may be obsolete.
@item @code{exit}
Exit
@code{ntpq}
@item @code{host} @kbd{hostname}
Set the host to which future queries will be sent.
@kbd{hostname}
may be either a host name or a numeric address.
@item @code{hostnames} @code{[@code{yes} | @code{no}]}
If
@code{yes}
is specified, host names are printed in
information displays.
If
@code{no}
is specified, numeric
addresses are printed instead.
The default is
@code{yes},
unless
modified using the command line
@code{-n}
switch.
@item @code{keyid} @kbd{keyid}
This command allows the specification of a key number to be
used to authenticate configuration requests.
This must correspond
to the
@code{controlkey}
key number the server has been configured to use for this
purpose.
@item @code{keytype} @code{[@code{md5} | @code{OpenSSLDigestType}]}
Specify the type of key to use for authenticating requests.
@code{md5}
is alway supported.
If
@code{ntpq}
was built with OpenSSL support,
any digest type supported by OpenSSL can also be provided.
If no argument is given, the current
@code{keytype}
is displayed.
@item @code{ntpversion} @code{[@code{1} | @code{2} | @code{3} | @code{4}]}
Sets the NTP version number which
@code{ntpq}
claims in
packets.
Defaults to 3, and note that mode 6 control messages (and
modes, for that matter) didn't exist in NTP version 1.
There appear
to be no servers left which demand version 1.
With no argument, displays the current NTP version that will be used
when communicating with servers.
@item @code{passwd}
This command prompts you to type in a password (which will not
be echoed) which will be used to authenticate configuration
requests.
The password must correspond to the key configured for
use by the NTP server for this purpose if such requests are to be
successful.
@code{poll}
@kbd{n}
@code{verbose}
@item @code{quit}
Exit
@code{ntpq}
@item @code{raw}
Causes all output from query commands is printed as received
from the remote server.
The only formating/interpretation done on
the data is to transform nonascii data into a printable (but barely
understandable) form.
@item @code{timeout} @kbd{milliseconds}
Specify a timeout period for responses to server queries.
The
default is about 5000 milliseconds.
Note that since
@code{ntpq}
retries each query once after a timeout, the total waiting time for
a timeout will be twice the timeout value set.
@item @code{version}
Print the version of the
@code{ntpq}
program.
@end table

@subsubsection Control Message Commands
Association IDs are used to identify system, peer and clock variables.
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.
Most control commands send a single mode-6 message to the server and expect a single response message.
The exceptions are the
@code{peers}
command, which sends a series of messages,
and the
@code{mreadlist}
and
@code{mreadvar}
commands, which iterate over a range of associations.
@table @asis
@item @code{associations}
Display a list of mobilized associations in the form:
@example
ind assid status conf reach auth condition last_event cnt
@end example
@table @asis
@item Sy String Ta Sy Description
@item @code{ind} @code{Ta} @code{index} @code{on} @code{this} @code{list}
@item @code{assid} @code{Ta} @code{association} @code{ID}
@item @code{status} @code{Ta} @code{peer} @code{status} @code{word}
@item @code{conf} @code{Ta} @code{yes}: @code{persistent,} @code{no}: @code{ephemeral}
@item @code{reach} @code{Ta} @code{yes}: @code{reachable,} @code{no}: @code{unreachable}
@item @code{auth} @code{Ta} @code{ok}, @code{yes}, @code{bad} @code{and} @code{none}
@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)}
@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)}
@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)}
@end table
@item @code{authinfo}
Display the authentication statistics.
@item @code{clockvar} @kbd{assocID} @code{[@kbd{name}@code{[@code{=}@kbd{value}]}]} @code{[...]}
@item @code{cv} @kbd{assocID} @code{[@kbd{name}@code{[@code{=}@kbd{value}]}]} @code{[...]}
Display a list of clock variables for those associations supporting a reference clock.
@item @code{:config} @code{[...]}
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.
@item @code{config-from-file} @kbd{filename}
Send the each line of
@kbd{filename}
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.
@item @code{ifstats}
Display statistics for each local network address. Authentication is required.
@item @code{iostats}
Display network and reference clock I/O statistics.
@item @code{kerninfo}
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.
@item @code{lassociations}
Perform the same function as the associations command, except display mobilized and unmobilized associations.
@item @code{lopeers} @code{[@code{-4} | @code{-6}]}
Obtain and print a list of all peers and clients showing
@kbd{dstadr}
(associated with any given IP version).
@item @code{lpeers} @code{[@code{-4} | @code{-6}]}
Print a peer spreadsheet for the appropriate IP version(s).
@kbd{dstadr}
(associated with any given IP version).
@item @code{monstats}
Display monitor facility statistics.
@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}]}
Obtain and print traffic counts collected and maintained by the monitor facility.
With the exception of
@code{sort}=@kbd{sortorder},
the options filter the list returned by
@code{ntpd.}
The
@code{limited}
and
@code{kod}
options return only entries representing client addresses from which the last packet received triggered either discarding or a KoD response.
The
@code{mincount}=@kbd{count}
option filters entries representing less than
@kbd{count}
packets.
The
@code{laddr}=@kbd{localaddr}
option filters entries for packets received on any local address other than
@kbd{localaddr}.
@code{resany}=@kbd{hexmask}
and
@code{resall}=@kbd{hexmask}
filter entries containing none or less than all, respectively, of the bits in
@kbd{hexmask},
which must begin with
@code{0x}.
The
@kbd{sortorder}
defaults to
@code{lstint}
and may be any of
@code{addr},
@code{count},
@code{avgint},
@code{lstint},
or any of those preceded by a minus sign (hyphen) to reverse the sort order.
The output columns are:
@table @asis
@item Column
Description
@item @code{lstint}
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
@code{ntpq}
@item @code{avgint}
Average interval in s between packets from this address.
@item @code{rstr}
Restriction flags associated with this address.
Most are copied unchanged from the matching
@code{restrict}
command, however 0x400 (kod) and 0x20 (limited) flags are cleared unless the last packet from this address triggered a rate control response.
@item @code{r}
Rate control indicator, either
a period,
@code{L}
or
@code{K}
for no rate control response,
rate limiting by discarding, or rate limiting with a KoD response, respectively.
@item @code{m}
Packet mode.
@item @code{v}
Packet version number.
@item @code{count}
Packets received from this address.
@item @code{rport}
Source port of last packet from this address.
@item @code{remote} @code{address}
DNS name, numeric address, or address followed by
claimed DNS name which could not be verified in parentheses.
@end table
@item @code{mreadvar} @code{assocID} @code{assocID} @code{[@kbd{variable_name}@code{[=@kbd{value}]} ...]}
@item @code{mrv} @code{assocID} @code{assocID} @code{[@kbd{variable_name}@code{[=@kbd{value}]} ...]}
Perform the same function as the
@code{readvar}
command, except for a range of association IDs.
This range is determined from the association list cached by the most recent
@code{associations}
command.
@item @code{opeers} @code{[@code{-4} | @code{-6}]}
Obtain and print the old-style list of all peers and clients showing
@kbd{dstadr}
(associated with any given IP version),
rather than the
@kbd{refid}.
@item @code{passociations}
Perform the same function as the
@code{associations}
command,
except that it uses previously stored data rather than making a new query.
@item @code{peers}
Display a list of peers in the form:
@example
[tally]remote refid st t when pool reach delay offset jitter
@end example
@table @asis
@item Variable
Description
@item @code{[tally]}
single-character code indicating current value of the
@code{select}
field of the
.Lk decode.html#peer "peer status word"
@item @code{remote}
host name (or IP number) of peer.
The value displayed will be truncated to 15 characters  unless the
@code{-w}
flag is given, in which case the full value will be displayed
on the first line,
and the remaining data is displayed on the next line.
@item @code{refid}
association ID or
.Lk decode.html#kiss "'kiss code"
@item @code{st}
stratum
@item @code{t}
@code{u}:
unicast or manycast client,
@code{b}:
broadcast or multicast client,
@code{l}:
local (reference clock),
@code{s}:
symmetric (peer),
@code{A}:
manycast server,
@code{B}:
broadcast server,
@code{M}:
multicast server
@item @code{when}
sec/min/hr since last received packet
@item @code{poll}
poll interval (log2 s)
@item @code{reach}
reach shift register (octal)
@item @code{delay}
roundtrip delay
@item @code{offset}
offset of server relative to this host
@item @code{jitter}
jitter
@end table
@item @code{apeers}
Display a list of peers in the form:
@example
[tally]remote refid assid st t when pool reach delay offset jitter
@end example
where the output is just like the
@code{peers}
command except that the
@code{refid}
is displayed in hex format and the association number is also displayed.
@item @code{pstats} @kbd{assocID}
Show the statistics for the peer with the given
@kbd{assocID}.
@item @code{readlist} @kbd{assocID}
@item @code{rl} @kbd{assocID}
Read the system or peer variables included in the variable list.
@item @code{readvar} @kbd{assocID} @kbd{name}@code{[=@kbd{value}]} @code{[, ...]}
@item @code{rv} @kbd{assocID} @kbd{name}@code{[=@kbd{value}]} @code{[, ...]}
Display the specified variables.
If
@kbd{assocID}
is zero, the variables are from the
@ref{System Variables}
name space, otherwise they are from the
@ref{Peer Variables}
name space.
The
@kbd{assocID}
is required, as the same name can occur in both spaces.
If no
@kbd{name}
is included, all operative variables in the name space are displayed.

In this case only, if the
@kbd{assocID}
is omitted, it is assumed zero.
Multiple names are specified with comma separators and without whitespace.
Note that time values are represented in milliseconds
and frequency values in parts-per-million (PPM).
Some NTP timestamps are represented in the format
YYYYMMDDTTTT ,
where YYYY is the year,
MM the month of year,
DD the day of month and
TTTT the time of day.
@item @code{reslist}
Show the access control (restrict) list for
@code{ntpq}

@item @code{saveconfig} @kbd{filename}
Write the current configuration,
including any runtime modifications given with
@code{:config}
or
@code{config-from-file},
to the ntpd host's file
@kbd{filename}.
This command will be rejected by the server unless
.Lk miscopt.html#saveconfigdir "saveconfigdir"
appears in the
@code{ntpd}
configuration file.
@kbd{filename}
can use
@code{strftime()}
format specifies to substitute the current date and time, for example,
@code{q]saveconfig} @code{ntp-%Y%m%d-%H%M%S.confq]}.
The filename used is stored in system variable
@code{savedconfig}.
Authentication is required.
@item @code{timerstats}
Display interval timer counters.
@item @code{writelist} @kbd{assocID}
Write the system or peer variables included in the variable list.
@item @code{writevar} @kbd{assocID} @kbd{name}=@kbd{value} @code{[, ...]}
Write the specified variables.
If the
@kbd{assocID}
is zero, the variables are from the
@ref{System Variables}
name space, otherwise they are from the
@ref{Peer Variables}
name space.
The
@kbd{assocID}
is required, as the same name can occur in both spaces.
@item @code{sysinfo}
Display operational summary.
@item @code{sysstats}
Print statistics counters maintained in the protocol module.
@end table

@subsubsection Status Words and Kiss Codes

The current state of the operating program is shown
in a set of status words
maintained by the system.
Status information is also available on a per-association basis.
These words are displayed in the
@code{rv}
and
@code{as}
commands both in hexadecimal and in decoded short tip strings.
The codes, tips and short explanations are documented on the
.Lk decode.html "Event Messages and Status Words"
page.
The page also includes a list of system and peer messages,
the code for the latest of which is included in the status word.

Information resulting from protocol machine state transitions
is displayed using an informal set of ASCII strings called
.Lk decode.html#kiss "kiss codes" .
The original purpose was for kiss-o'-death (KoD) packets
sent by the server to advise the client of an unusual condition.
They are now displayed, when appropriate,
in the reference identifier field in various billboards.

@subsubsection System Variables
The following system variables appear in the
@code{rv}
billboard.
Not all variables are displayed in some configurations.
@table @asis
@item Variable
Description
@item @code{status}
.Lk decode.html#sys "system status word"
@item @code{version}
NTP software version and build time
@item @code{processor}
hardware platform and version
@item @code{system}
operating system and version
@item @code{leap}
leap warning indicator (0-3)
@item @code{stratum}
stratum (1-15)
@item @code{precision}
precision (log2 s)
@item @code{rootdelay}
total roundtrip delay to the primary reference clock
@item @code{rootdisp}
total dispersion to the primary reference clock
@item @code{peer}
system peer association ID
@item @code{tc}
time constant and poll exponent (log2 s) (3-17)
@item @code{mintc}
minimum time constant (log2 s) (3-10)
@item @code{clock}
date and time of day
@item @code{refid}
reference ID or
.Lk decode.html#kiss "kiss code"
@item @code{reftime}
reference time
@item @code{offset}
combined  offset of server relative to this host
@item @code{sys_jitter}
combined system jitter
@item @code{frequency}
frequency offset (PPM) relative to hardware clock
@item @code{clk_wander}
clock frequency wander (PPM)
@item @code{clk_jitter}
clock jitter
@item @code{tai}
TAI-UTC offset (s)
@item @code{leapsec}
NTP seconds when the next leap second is/was inserted
@item @code{expire}
NTP seconds when the NIST leapseconds file expires
@end table
The jitter and wander statistics are exponentially-weighted RMS averages.
The system jitter is defined in the NTPv4 specification;
the clock jitter statistic is computed by the clock discipline module.

When the NTPv4 daemon is compiled with the OpenSSL software library,
additional system variables are displayed,
including some or all of the following,
depending on the particular Autokey dance:

@table @asis
@item Variable
Description
@item @code{host}
Autokey host name for this host
@item @code{ident}
Autokey group name for this host
@item @code{flags}
host flags  (see Autokey specification)
@item @code{digest}
OpenSSL message digest algorithm
@item @code{signature}
OpenSSL digest/signature scheme
@item @code{update}
NTP seconds at last signature update
@item @code{cert}
certificate subject, issuer and certificate flags
@item @code{until}
NTP seconds when the certificate expires
@end table
@subsubsection Peer Variables
The following peer variables appear in the
@code{rv}
billboard for each association.
Not all variables are displayed in some configurations.

@table @asis
@item Variable
Description
@item @code{associd}
association ID
@item @code{status}
.Lk decode.html#peer "peer status word"
@item @code{srcadr}
source (remote) IP address
@item @code{srcport}
source (remote) port
@item @code{dstadr}
destination (local) IP address
@item @code{dstport}
destination (local) port
@item @code{leap}
leap indicator (0-3)
@item @code{stratum}
stratum (0-15)
@item @code{precision}
precision (log2 s)
@item @code{rootdelay}
total roundtrip delay to the primary reference clock
@item @code{rootdisp}
total root dispersion to the primary reference clock
@item @code{refid}
reference ID or
.Lk decode.html#kiss "kiss code"
@item @code{reftime}
reference time
@item @code{reach}
reach register (octal)
@item @code{unreach}
unreach counter
@item @code{hmode}
host mode (1-6)
@item @code{pmode}
peer mode (1-5)
@item @code{hpoll}
host poll exponent (log2 s) (3-17)
@item @code{ppoll}
peer poll exponent (log2 s) (3-17)
@item @code{headway}
headway (see
.Lk rate.html "Rate Management and the Kiss-o'-Death Packet" )
@item @code{flash}
.Lk decode.html#flash "flash status word"
@item @code{offset}
filter offset
@item @code{delay}
filter delay
@item @code{dispersion}
filter dispersion
@item @code{jitter}
filter jitter
@item @code{ident}
Autokey group name for this association
@item @code{bias}
unicast/broadcast bias
@item @code{xleave}
interleave delay (see
.Lk xleave.html "NTP Interleaved Modes" )
@end table
The
@code{bias}
variable is calculated when the first broadcast packet is received
after the calibration volley.
It represents the offset of the broadcast subgraph relative to the unicast subgraph.
The
@code{xleave}
variable appears only for the interleaved symmetric and interleaved modes.
It represents the internal queuing, buffering and transmission delays
for the preceding packet.

When the NTPv4 daemon is compiled with the OpenSSL software library,
additional peer variables are displayed, including the following:
@table @asis
@item Variable
Description
@item @code{flags}
peer flags (see Autokey specification)
@item @code{host}
Autokey server name
@item @code{flags}
peer flags (see Autokey specification)
@item @code{signature}
OpenSSL digest/signature scheme
@item @code{initsequence}
initial key ID
@item @code{initkey}
initial key index
@item @code{timestamp}
Autokey signature timestamp
@end table

@subsubsection Clock Variables
The following clock variables appear in the
@code{cv}
billboard for each association with a reference clock.
Not all variables are displayed in some configurations.
@table @asis
@item Variable
Description
@item @code{associd}
association ID
@item @code{status}
.Lk decode.html#clock "clock status word"
@item @code{device}
device description
@item @code{timecode}
ASCII time code string (specific to device)
@item @code{poll}
poll messages sent
@item @code{noreply}
no reply
@item @code{badformat}
bad format
@item @code{baddata}
bad date or time
@item @code{fudgetime1}
fudge time 1
@item @code{fudgetime2}
fudge time 2
@item @code{stratum}
driver stratum
@item @code{refid}
driver reference ID
@item @code{flags}
driver flags
@end table

This section was generated by @strong{AutoGen},
using the @code{agtexi-cmd} template and the option descriptions for the @code{ntpq} program.
This software is released under the NTP license, <http://ntp.org/license>.

@menu
* ntpq usage::                  ntpq help/usage (@option{--help})
* ntpq ipv4::                   ipv4 option (-4)
* ntpq ipv6::                   ipv6 option (-6)
* ntpq command::                command option (-c)
* ntpq interactive::            interactive option (-i)
* ntpq numeric::                numeric option (-n)
* ntpq old-rv::                 old-rv option
* ntpq peers::                  peers option (-p)
* ntpq refid::                  refid option (-r)
* ntpq wide::                   wide option (-w)
* ntpq config::                 presetting/configuring ntpq
* ntpq exit status::            exit status
@end menu

@node ntpq usage
@subsection ntpq help/usage (@option{--help})
@cindex ntpq help

This is the automatically generated usage text for ntpq.

The text printed is the same whether selected with the @code{help} option
(@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
the usage text by passing it through a pager program.
@code{more-help} is disabled on platforms without a working
@code{fork(2)} function.  The @code{PAGER} environment variable is
used to select the program, defaulting to @file{more}.  Both will exit
with a status code of 0.

@exampleindent 0
@example
ntpq - standard NTP query program - Ver. 4.2.8p8
Usage:  ntpq [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
  Flg Arg Option-Name    Description
   -4 no  ipv4           Force IPv4 DNS name resolution
                                - prohibits the option 'ipv6'
   -6 no  ipv6           Force IPv6 DNS name resolution
                                - prohibits the option 'ipv4'
   -c Str command        run a command and exit
                                - may appear multiple times
   -d no  debug-level    Increase debug verbosity level
                                - may appear multiple times
   -D Num set-debug-level Set the debug verbosity level
                                - may appear multiple times
   -i no  interactive    Force ntpq to operate in interactive mode
                                - prohibits these options:
                                command
                                peers
   -n no  numeric        numeric host addresses
      no  old-rv         Always output status line with readvar
   -p no  peers          Print a list of the peers
                                - prohibits the option 'interactive'
   -r KWd refid          Set default display type for S2+ refids
   -w no  wide           Display the full 'remote' value
      opt version        output version information and exit
   -? no  help           display extended usage information and exit
   -! no  more-help      extended usage information passed thru pager
   -> opt save-opts      save the option state to a config file
   -< Str load-opts      load options from a config file
                                - disabled as '--no-load-opts'
                                - may appear multiple times

Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.

The following option preset mechanisms are supported:
 - reading file $HOME/.ntprc
 - reading file ./.ntprc
 - examining environment variables named NTPQ_*

The valid "refid" option keywords are:
  hash ipv4
  or an integer from 0 through 1

Please send bug reports to:  <http://bugs.ntp.org, bugs@@ntp.org>
@end example
@exampleindent 4

@node ntpq ipv4
@subsection ipv4 option (-4)
@cindex ntpq-ipv4

This is the ``force ipv4 dns name resolution'' option.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
must not appear in combination with any of the following options:
ipv6.
@end itemize

Force DNS resolution of following host names on the command line
to the IPv4 namespace.
@node ntpq ipv6
@subsection ipv6 option (-6)
@cindex ntpq-ipv6

This is the ``force ipv6 dns name resolution'' option.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
must not appear in combination with any of the following options:
ipv4.
@end itemize

Force DNS resolution of following host names on the command line
to the IPv6 namespace.
@node ntpq command
@subsection command option (-c)
@cindex ntpq-command

This is the ``run a command and exit'' option.
This option takes a string argument @file{cmd}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
may appear an unlimited number of times.
@end itemize

The following argument is interpreted as an interactive format command
and is added to the list of commands to be executed on the specified
host(s).
@node ntpq interactive
@subsection interactive option (-i)
@cindex ntpq-interactive

This is the ``force ntpq to operate in interactive mode'' option.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
must not appear in combination with any of the following options:
command, peers.
@end itemize

Force @code{ntpq} to operate in interactive mode.
Prompts will be written to the standard output and
commands read from the standard input.
@node ntpq numeric
@subsection numeric option (-n)
@cindex ntpq-numeric

This is the ``numeric host addresses'' option.
Output all host addresses in dotted-quad numeric format rather than
converting to the canonical host names. 
@node ntpq old-rv
@subsection old-rv option
@cindex ntpq-old-rv

This is the ``always output status line with readvar'' option.
By default, @code{ntpq} now suppresses the @code{associd=...}
line that precedes the output of @code{readvar}
(alias @code{rv}) when a single variable is requested, such as
@code{ntpq -c "rv 0 offset"}.
This option causes @code{ntpq} to include both lines of output
for a single-variable @code{readvar}.
Using an environment variable to
preset this option in a script will enable both older and
newer @code{ntpq} to behave identically in this regard.
@node ntpq peers
@subsection peers option (-p)
@cindex ntpq-peers

This is the ``print a list of the peers'' option.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
must not appear in combination with any of the following options:
interactive.
@end itemize

Print a list of the peers known to the server as well as a summary
of their state. This is equivalent to the 'peers' interactive command.
@node ntpq refid
@subsection refid option (-r)
@cindex ntpq-refid

This is the ``set default display type for s2+ refids'' option.
This option takes a keyword argument.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
This option takes a keyword as its argument.
The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_REFID).
The available keywords are:
@example
    hash ipv4
@end example

or their numeric equivalent.@end itemize

Set the default display format for S2+ refids.
@node ntpq wide
@subsection wide option (-w)
@cindex ntpq-wide

This is the ``display the full 'remote' value'' option.
Display the full value of the 'remote' value.  If this requires
more than 15 characters, display the full value, emit a newline,
and continue the data display properly indented on the next line.


@node ntpq config
@subsection presetting/configuring ntpq

Any option that is not marked as @i{not presettable} may be preset by
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
the options listed above in upper case and segmented with underscores.
The @code{NTPQ} variable will be tokenized and parsed like
the command line.  The remaining variables are tested for existence and their
values are treated like option arguments.


@noindent
@code{libopts} will search in 2 places for configuration files:
@itemize @bullet
@item
$HOME
@item
$PWD
@end itemize
The environment variables @code{HOME}, and @code{PWD}
are expanded and replaced when @file{ntpq} runs.
For any of these that are plain files, they are simply processed.
For any that are directories, then a file named @file{.ntprc} is searched for
within that directory and processed.

Configuration files may be in a wide variety of formats.
The basic format is an option name followed by a value (argument) on the
same line.  Values may be separated from the option name with a colon,
equal sign or simply white space.  Values may be continued across multiple
lines by escaping the newline with a backslash.

Multiple programs may also share the same initialization file.
Common options are collected at the top, followed by program specific
segments.  The segments are separated by lines like:
@example
[NTPQ]
@end example
@noindent
or by
@example
<?program ntpq>
@end example
@noindent
Do not mix these styles within one configuration file.

Compound values and carefully constructed string values may also be
specified using XML syntax:
@example
<option-name>
   <sub-opt>...&lt;...&gt;...</sub-opt>
</option-name>
@end example
@noindent
yielding an @code{option-name.sub-opt} string value of
@example
"...<...>..."
@end example
@code{AutoOpts} does not track suboptions.  You simply note that it is a
hierarchicly valued option.  @code{AutoOpts} does provide a means for searching
the associated name/value pair list (see: optionFindValue).

The command line options relating to configuration and/or usage help are:

@subsubheading version (-)

Print the program version to standard out, optionally with licensing
information, then exit 0.  The optional argument specifies how much licensing
detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument.
Only the first letter of the argument is examined:

@table @samp
@item version
Only print the version.  This is the default.
@item copyright
Name the copyright usage licensing terms.
@item verbose
Print the full copyright usage licensing terms.
@end table

@node ntpq exit status
@subsection ntpq exit status

One of the following exit values will be returned:
@table @samp
@item 0 (EXIT_SUCCESS)
Successful program execution.
@item 1 (EXIT_FAILURE)
The operation failed or the command syntax was not valid.
@item 66 (EX_NOINPUT)
A specified configuration file could not be loaded.
@item 70 (EX_SOFTWARE)
libopts had an internal operational error.  Please report
it to autogen-users@@lists.sourceforge.net.  Thank you.
@end table