cmdmon: add good responses to ntpdata report

This commit is contained in:
Miroslav Lichvar 2022-08-18 11:59:40 +02:00
parent b84d6759f9
commit 166e43b13e
8 changed files with 17 additions and 4 deletions

View file

@ -734,7 +734,8 @@ typedef struct {
uint32_t total_tx_count;
uint32_t total_rx_count;
uint32_t total_valid_count;
uint32_t reserved[4];
uint32_t total_good_count;
uint32_t reserved[3];
int32_t EOR;
} RPY_NTPData;

View file

@ -2346,7 +2346,8 @@ process_cmd_ntpdata(char *line)
"RX timestamping : %N\n"
"Total TX : %U\n"
"Total RX : %U\n"
"Total valid RX : %U\n",
"Total valid RX : %U\n"
"Total good RX : %U\n",
UTI_IPToString(&remote_addr), (unsigned long)UTI_IPToRefid(&remote_addr),
ntohs(reply.data.ntp_data.remote_port),
UTI_IPToString(&local_addr), (unsigned long)UTI_IPToRefid(&local_addr),
@ -2374,6 +2375,7 @@ process_cmd_ntpdata(char *line)
(unsigned long)ntohl(reply.data.ntp_data.total_tx_count),
(unsigned long)ntohl(reply.data.ntp_data.total_rx_count),
(unsigned long)ntohl(reply.data.ntp_data.total_valid_count),
(unsigned long)ntohl(reply.data.ntp_data.total_good_count),
REPORT_END);
}

View file

@ -1224,6 +1224,7 @@ handle_ntp_data(CMD_Request *rx_message, CMD_Reply *tx_message)
tx_message->data.ntp_data.total_tx_count = htonl(report.total_tx_count);
tx_message->data.ntp_data.total_rx_count = htonl(report.total_rx_count);
tx_message->data.ntp_data.total_valid_count = htonl(report.total_valid_count);
tx_message->data.ntp_data.total_good_count = htonl(report.total_good_count);
memset(tx_message->data.ntp_data.reserved, 0xff, sizeof (tx_message->data.ntp_data.reserved));
}

View file

@ -662,6 +662,7 @@ RX timestamping : Kernel
Total TX : 24
Total RX : 24
Total valid RX : 24
Total good RX : 22
----
+
The fields are explained as follows:
@ -715,7 +716,10 @@ The number of packets sent to the source.
*Total RX*:::
The number of all packets received from the source.
*Total valid RX*:::
The number of valid packets received from the source.
The number of packets which passed the first two groups of NTP tests.
*Total good RX*:::
The number of packets which passed all three groups of NTP tests, i.e. the NTP
measurement was accepted.
[[add_peer]]*add peer* _name_ [_option_]...::
The *add peer* command allows a new NTP peer to be added whilst

View file

@ -2216,6 +2216,8 @@ process_response(NCR_Instance inst, NTP_Local_Address *local_addr,
inst->report.rx_tss_char = tss_chars[local_receive.source];
inst->report.total_valid_count++;
if (good_packet)
inst->report.total_good_count++;
}
/* Do measurement logging */

View file

@ -174,6 +174,7 @@ typedef struct {
uint32_t total_tx_count;
uint32_t total_rx_count;
uint32_t total_valid_count;
uint32_t total_good_count;
} RPT_NTPReport;
typedef struct {

View file

@ -231,6 +231,7 @@ RX timestamping : Kernel
Total TX : 1
Total RX : 1
Total valid RX : 1
Total good RX : 0
S Name/IP Address Auth COpts EOpts Last Score Interval Leap
=======================================================================
M node1\.net1\.clk N ----- ----- 0 1\.0 \+0ns \+0ns N

View file

@ -95,7 +95,8 @@ TX timestamping : (Daemon|Kernel)
RX timestamping : (Daemon|Kernel)
Total TX : [0-9]+
Total RX : [0-9]+
Total valid RX : [0-9]+$" || test_fail
Total valid RX : [0-9]+
Total good RX : [0-9]+$" || test_fail
run_chronyc "selectdata" || test_fail
check_chronyc_output "^S Name/IP Address Auth COpts EOpts Last Score Interval Leap