#define RPY_CLIENT_ACCESSES_BY_INDEX3 21
#define RPY_SERVER_STATS2 22
#define RPY_SELECT_DATA 23
-#define N_REPLY_TYPES 24
+#define RPY_SERVER_STATS3 24
+#define N_REPLY_TYPES 25
/* Status codes */
#define STT_SUCCESS 0
uint32_t cmd_drops;
uint32_t log_drops;
uint32_t ntp_auth_hits;
+ uint32_t ntp_interleaved_hits;
+ uint32_t ntp_timestamps;
+ uint32_t ntp_span_seconds;
int32_t EOR;
} RPY_ServerStats;
CMD_Reply reply;
request.command = htons(REQ_SERVER_STATS);
- if (!request_reply(&request, &reply, RPY_SERVER_STATS2, 0))
+ if (!request_reply(&request, &reply, RPY_SERVER_STATS3, 0))
return 0;
print_report("NTP packets received : %U\n"
"Client log records dropped : %U\n"
"NTS-KE connections accepted: %U\n"
"NTS-KE connections dropped : %U\n"
- "Authenticated NTP packets : %U\n",
+ "Authenticated NTP packets : %U\n"
+ "Interleaved NTP packets : %U\n"
+ "NTP timestamps held : %U\n"
+ "NTP timestamp span : %U\n",
(unsigned long)ntohl(reply.data.server_stats.ntp_hits),
(unsigned long)ntohl(reply.data.server_stats.ntp_drops),
(unsigned long)ntohl(reply.data.server_stats.cmd_hits),
(unsigned long)ntohl(reply.data.server_stats.nke_hits),
(unsigned long)ntohl(reply.data.server_stats.nke_drops),
(unsigned long)ntohl(reply.data.server_stats.ntp_auth_hits),
+ (unsigned long)ntohl(reply.data.server_stats.ntp_interleaved_hits),
+ (unsigned long)ntohl(reply.data.server_stats.ntp_timestamps),
+ (unsigned long)ntohl(reply.data.server_stats.ntp_span_seconds),
REPORT_END);
return 1;
static uint32_t total_hits[MAX_SERVICES];
static uint32_t total_drops[MAX_SERVICES];
static uint32_t total_ntp_auth_hits;
+static uint32_t total_ntp_interleaved_hits;
static uint32_t total_record_drops;
#define NSEC_PER_SEC 1000000000U
if (find_ntp_rx_ts(ntp64_to_int64(rx_ts), &index))
get_ntp_tss(index)->flags |= NTPTS_DISABLED;
+
+ /* This assumes the function is called only to prevent multiple
+ interleaved responses to the same timestamp */
+ total_ntp_interleaved_hits++;
}
/* ================================================== */
report->cmd_drops = total_drops[CLG_CMDMON];
report->log_drops = total_record_drops;
report->ntp_auth_hits = total_ntp_auth_hits;
+ report->ntp_interleaved_hits = total_ntp_interleaved_hits;
+ report->ntp_timestamps = ntp_ts_map.size;
+ report->ntp_span_seconds = ntp_ts_map.size > 1 ?
+ (get_ntp_tss(ntp_ts_map.size - 1)->rx_ts -
+ get_ntp_tss(0)->rx_ts) >> 32 : 0;
}
RPT_ServerStatsReport report;
CLG_GetServerStatsReport(&report);
- tx_message->reply = htons(RPY_SERVER_STATS2);
+ tx_message->reply = htons(RPY_SERVER_STATS3);
tx_message->data.server_stats.ntp_hits = htonl(report.ntp_hits);
tx_message->data.server_stats.nke_hits = htonl(report.nke_hits);
tx_message->data.server_stats.cmd_hits = htonl(report.cmd_hits);
tx_message->data.server_stats.cmd_drops = htonl(report.cmd_drops);
tx_message->data.server_stats.log_drops = htonl(report.log_drops);
tx_message->data.server_stats.ntp_auth_hits = htonl(report.ntp_auth_hits);
+ tx_message->data.server_stats.ntp_interleaved_hits = htonl(report.ntp_interleaved_hits);
+ tx_message->data.server_stats.ntp_timestamps = htonl(report.ntp_timestamps);
+ tx_message->data.server_stats.ntp_span_seconds = htonl(report.ntp_span_seconds);
}
/* ================================================== */
received/accepted.
[[serverstats]]*serverstats*::
-The *serverstats* command displays how many valid NTP and command requests, and
-NTS-KE connections, *chronyd* operating as a server received from clients, and
-how many of them were dropped due to rate limiting. It also displays how many
-client log records were dropped due to the memory limit configured by the
-<<chrony.conf.adoc#clientloglimit,*clientloglimit*>> directive and how many of
-the NTP requests (from those which were not dropped) were authenticated. An
-example of the output is shown below.
+The *serverstats* command displays NTP and command server statistics.
++
+An example of the output is shown below.
+
----
NTP packets received : 1598
NTS-KE connections accepted: 3
NTS-KE connections dropped : 0
Authenticated NTP packets : 189
+Interleaved NTP packets : 43
+NTP timestamps held : 44
+NTP timestamp span : 120
----
++
+The fields have the following meaning:
++
+*NTP packets received*:::
+The number of valid NTP requests received by the server.
+*NTP packets dropped*:::
+The number of NTP requests dropped by the server due to rate limiting
+(configured by the <<chrony.conf.adoc#ratelimit,*ratelimit*>> directive).
+*Command packets received*:::
+The number of command requests received by the server.
+*Command packets dropped*:::
+The number of command requests dropped by the server due to rate limiting
+(configured by the <<chrony.conf.adoc#cmdratelimit,*cmdratelimit*>> directive).
+*Client log records dropped*:::
+The number of client log records dropped by the server to limit the memory use
+(configured by the <<chrony.conf.adoc#clientloglimit,*clientloglimit*>>
+directive).
+*NTS-KE connections accepted*:::
+The number of NTS-KE connections accepted by the server.
+*NTS-KE connections dropped*:::
+The number of NTS-KE connections dropped by the server due to rate limiting
+(configured by the <<chrony.conf.adoc#ntsratelimit,*ntsratelimit*>> directive).
+*Authenticated NTP packets*:::
+The number of received NTP requests that were authenticated (with a symmetric
+key or NTS).
+*Interleaved NTP packets*:::
+The number of received NTP requests that were detected to be in the interleaved
+mode.
+*NTP timestamps held*:::
+The number of pairs of receive and transmit timestamps that the server is
+currently holding in memory for clients using the interleaved mode.
+*NTP timestamp span*:::
+The interval (in seconds) covered by the currently held NTP timestamps.
+{blank}::
++
+Note that the numbers reported by this overflow to zero after 4294967295
+(32-bit values).
[[allow]]*allow* [*all*] [_subnet_]::
The effect of the allow command is identical to the
RPY_LENGTH_ENTRY(ntp_source_name), /* NTP_SOURCE_NAME */
RPY_LENGTH_ENTRY(auth_data), /* AUTH_DATA */
RPY_LENGTH_ENTRY(client_accesses_by_index), /* CLIENT_ACCESSES_BY_INDEX3 */
- RPY_LENGTH_ENTRY(server_stats), /* SERVER_STATS2 */
+ 0, /* SERVER_STATS2 - not supported */
RPY_LENGTH_ENTRY(select_data), /* SELECT_DATA */
+ RPY_LENGTH_ENTRY(server_stats), /* SERVER_STATS3 */
};
/* ================================================== */
uint32_t cmd_drops;
uint32_t log_drops;
uint32_t ntp_auth_hits;
+ uint32_t ntp_interleaved_hits;
+ uint32_t ntp_timestamps;
+ uint32_t ntp_span_seconds;
} RPT_ServerStatsReport;
typedef struct {
Client log records dropped : 0
NTS-KE connections accepted: 0
NTS-KE connections dropped : 0
-Authenticated NTP packets : 0$" || test_fail
+Authenticated NTP packets : 0
+Interleaved NTP packets : 0
+NTP timestamps held : 0
+NTP timestamp span : 0$" || test_fail
chronyc_conf="
deny all
Client log records dropped : 0
NTS-KE connections accepted: 0
NTS-KE connections dropped : 0
-Authenticated NTP packets : 0$" || test_fail
+Authenticated NTP packets : 0
+Interleaved NTP packets : 0
+NTP timestamps held : 0
+NTP timestamp span : 0$"|| test_fail
run_chronyc "manual on" || test_fail
check_chronyc_output "^200 OK$" || test_fail