cmdmon: switch serverstats to 64-bit integers
Update the serverstats response to use the new 64-bit integers. Don't define a new value for the response as it already had an incompatible change since the latest release (new fields added for timestamp counters).
This commit is contained in:
parent
907accec87
commit
5508b01bd8
4 changed files with 84 additions and 73 deletions
36
candm.h
36
candm.h
|
@ -672,24 +672,24 @@ typedef struct {
|
|||
} RPY_ClientAccessesByIndex;
|
||||
|
||||
typedef struct {
|
||||
uint32_t ntp_hits;
|
||||
uint32_t nke_hits;
|
||||
uint32_t cmd_hits;
|
||||
uint32_t ntp_drops;
|
||||
uint32_t nke_drops;
|
||||
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;
|
||||
uint32_t ntp_daemon_rx_timestamps;
|
||||
uint32_t ntp_daemon_tx_timestamps;
|
||||
uint32_t ntp_kernel_rx_timestamps;
|
||||
uint32_t ntp_kernel_tx_timestamps;
|
||||
uint32_t ntp_hw_rx_timestamps;
|
||||
uint32_t ntp_hw_tx_timestamps;
|
||||
uint32_t reserved[4];
|
||||
Integer64 ntp_hits;
|
||||
Integer64 nke_hits;
|
||||
Integer64 cmd_hits;
|
||||
Integer64 ntp_drops;
|
||||
Integer64 nke_drops;
|
||||
Integer64 cmd_drops;
|
||||
Integer64 log_drops;
|
||||
Integer64 ntp_auth_hits;
|
||||
Integer64 ntp_interleaved_hits;
|
||||
Integer64 ntp_timestamps;
|
||||
Integer64 ntp_span_seconds;
|
||||
Integer64 ntp_daemon_rx_timestamps;
|
||||
Integer64 ntp_daemon_tx_timestamps;
|
||||
Integer64 ntp_kernel_rx_timestamps;
|
||||
Integer64 ntp_kernel_tx_timestamps;
|
||||
Integer64 ntp_hw_rx_timestamps;
|
||||
Integer64 ntp_hw_tx_timestamps;
|
||||
Integer64 reserved[4];
|
||||
int32_t EOR;
|
||||
} RPY_ServerStats;
|
||||
|
||||
|
|
73
client.c
73
client.c
|
@ -1623,6 +1623,7 @@ print_report(const char *format, ...)
|
|||
const char *string;
|
||||
unsigned long long_uinteger;
|
||||
unsigned int uinteger;
|
||||
uint64_t uinteger64;
|
||||
int integer;
|
||||
struct timespec *ts;
|
||||
struct tm *tm;
|
||||
|
@ -1815,6 +1816,10 @@ print_report(const char *format, ...)
|
|||
ts = va_arg(ap, struct timespec *);
|
||||
printf("%s", UTI_TimespecToString(ts));
|
||||
break;
|
||||
case 'Q': /* uint64_t in decimal */
|
||||
uinteger64 = va_arg(ap, uint64_t);
|
||||
printf("%*"PRIu64, width, uinteger64);
|
||||
break;
|
||||
case 'b': /* unsigned int in binary */
|
||||
uinteger = va_arg(ap, unsigned int);
|
||||
for (i = prec - 1; i >= 0; i--)
|
||||
|
@ -2481,40 +2486,40 @@ process_cmd_serverstats(char *line)
|
|||
if (!request_reply(&request, &reply, RPY_SERVER_STATS4, 0))
|
||||
return 0;
|
||||
|
||||
print_report("NTP packets received : %U\n"
|
||||
"NTP packets dropped : %U\n"
|
||||
"Command packets received : %U\n"
|
||||
"Command packets dropped : %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"
|
||||
"Interleaved NTP packets : %U\n"
|
||||
"NTP timestamps held : %U\n"
|
||||
"NTP timestamp span : %U\n"
|
||||
"NTP daemon RX timestamps : %U\n"
|
||||
"NTP daemon TX timestamps : %U\n"
|
||||
"NTP kernel RX timestamps : %U\n"
|
||||
"NTP kernel TX timestamps : %U\n"
|
||||
"NTP hardware RX timestamps : %U\n"
|
||||
"NTP hardware TX timestamps : %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.cmd_drops),
|
||||
(unsigned long)ntohl(reply.data.server_stats.log_drops),
|
||||
(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),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_daemon_rx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_daemon_tx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_kernel_rx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_kernel_tx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_hw_rx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_hw_tx_timestamps),
|
||||
print_report("NTP packets received : %Q\n"
|
||||
"NTP packets dropped : %Q\n"
|
||||
"Command packets received : %Q\n"
|
||||
"Command packets dropped : %Q\n"
|
||||
"Client log records dropped : %Q\n"
|
||||
"NTS-KE connections accepted: %Q\n"
|
||||
"NTS-KE connections dropped : %Q\n"
|
||||
"Authenticated NTP packets : %Q\n"
|
||||
"Interleaved NTP packets : %Q\n"
|
||||
"NTP timestamps held : %Q\n"
|
||||
"NTP timestamp span : %Q\n"
|
||||
"NTP daemon RX timestamps : %Q\n"
|
||||
"NTP daemon TX timestamps : %Q\n"
|
||||
"NTP kernel RX timestamps : %Q\n"
|
||||
"NTP kernel TX timestamps : %Q\n"
|
||||
"NTP hardware RX timestamps : %Q\n"
|
||||
"NTP hardware TX timestamps : %Q\n",
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_hits),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_drops),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.cmd_hits),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.cmd_drops),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.log_drops),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.nke_hits),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.nke_drops),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_auth_hits),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_interleaved_hits),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_timestamps),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_span_seconds),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_daemon_rx_timestamps),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_daemon_tx_timestamps),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_kernel_rx_timestamps),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_kernel_tx_timestamps),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_hw_rx_timestamps),
|
||||
UTI_Integer64NetworkToHost(reply.data.server_stats.ntp_hw_tx_timestamps),
|
||||
REPORT_END);
|
||||
|
||||
return 1;
|
||||
|
|
44
cmdmon.c
44
cmdmon.c
|
@ -1178,23 +1178,33 @@ handle_server_stats(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
|
||||
CLG_GetServerStatsReport(&report);
|
||||
tx_message->reply = htons(RPY_SERVER_STATS4);
|
||||
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.ntp_drops = htonl(report.ntp_drops);
|
||||
tx_message->data.server_stats.nke_drops = htonl(report.nke_drops);
|
||||
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);
|
||||
tx_message->data.server_stats.ntp_daemon_rx_timestamps = htonl(report.ntp_daemon_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_daemon_tx_timestamps = htonl(report.ntp_daemon_tx_timestamps);
|
||||
tx_message->data.server_stats.ntp_kernel_rx_timestamps = htonl(report.ntp_kernel_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_kernel_tx_timestamps = htonl(report.ntp_kernel_tx_timestamps);
|
||||
tx_message->data.server_stats.ntp_hw_rx_timestamps = htonl(report.ntp_hw_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_hw_tx_timestamps = htonl(report.ntp_hw_tx_timestamps);
|
||||
tx_message->data.server_stats.ntp_hits = UTI_Integer64HostToNetwork(report.ntp_hits);
|
||||
tx_message->data.server_stats.nke_hits = UTI_Integer64HostToNetwork(report.nke_hits);
|
||||
tx_message->data.server_stats.cmd_hits = UTI_Integer64HostToNetwork(report.cmd_hits);
|
||||
tx_message->data.server_stats.ntp_drops = UTI_Integer64HostToNetwork(report.ntp_drops);
|
||||
tx_message->data.server_stats.nke_drops = UTI_Integer64HostToNetwork(report.nke_drops);
|
||||
tx_message->data.server_stats.cmd_drops = UTI_Integer64HostToNetwork(report.cmd_drops);
|
||||
tx_message->data.server_stats.log_drops = UTI_Integer64HostToNetwork(report.log_drops);
|
||||
tx_message->data.server_stats.ntp_auth_hits =
|
||||
UTI_Integer64HostToNetwork(report.ntp_auth_hits);
|
||||
tx_message->data.server_stats.ntp_interleaved_hits =
|
||||
UTI_Integer64HostToNetwork(report.ntp_interleaved_hits);
|
||||
tx_message->data.server_stats.ntp_timestamps =
|
||||
UTI_Integer64HostToNetwork(report.ntp_timestamps);
|
||||
tx_message->data.server_stats.ntp_span_seconds =
|
||||
UTI_Integer64HostToNetwork(report.ntp_span_seconds);
|
||||
tx_message->data.server_stats.ntp_daemon_rx_timestamps =
|
||||
UTI_Integer64HostToNetwork(report.ntp_daemon_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_daemon_tx_timestamps =
|
||||
UTI_Integer64HostToNetwork(report.ntp_daemon_tx_timestamps);
|
||||
tx_message->data.server_stats.ntp_kernel_rx_timestamps =
|
||||
UTI_Integer64HostToNetwork(report.ntp_kernel_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_kernel_tx_timestamps =
|
||||
UTI_Integer64HostToNetwork(report.ntp_kernel_tx_timestamps);
|
||||
tx_message->data.server_stats.ntp_hw_rx_timestamps =
|
||||
UTI_Integer64HostToNetwork(report.ntp_hw_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_hw_tx_timestamps =
|
||||
UTI_Integer64HostToNetwork(report.ntp_hw_tx_timestamps);
|
||||
memset(tx_message->data.server_stats.reserved, 0xff,
|
||||
sizeof (tx_message->data.server_stats.reserved));
|
||||
}
|
||||
|
|
|
@ -1216,10 +1216,6 @@ NIC.
|
|||
*NTP hardware TX timestamps*:::
|
||||
The number of NTP responses (in the interleaved mode) which included a transmit
|
||||
timestamp captured by the NIC.
|
||||
{blank}::
|
||||
+
|
||||
Note that the numbers reported by this command overflow to zero after
|
||||
4294967295, i.e. they are 32-bit values.
|
||||
|
||||
[[allow]]*allow* [*all*] [_subnet_]::
|
||||
The effect of the allow command is identical to the
|
||||
|
|
Loading…
Reference in a new issue