cmdmon: add leap status to selectdata report
This commit is contained in:
parent
f15f6a86b0
commit
698f270b5b
7 changed files with 28 additions and 17 deletions
3
candm.h
3
candm.h
|
@ -764,7 +764,8 @@ typedef struct {
|
||||||
IPAddr ip_addr;
|
IPAddr ip_addr;
|
||||||
uint8_t state_char;
|
uint8_t state_char;
|
||||||
uint8_t authentication;
|
uint8_t authentication;
|
||||||
uint8_t pad[2];
|
uint8_t leap;
|
||||||
|
uint8_t pad;
|
||||||
uint16_t conf_options;
|
uint16_t conf_options;
|
||||||
uint16_t eff_options;
|
uint16_t eff_options;
|
||||||
uint32_t last_sample_ago;
|
uint32_t last_sample_ago;
|
||||||
|
|
17
client.c
17
client.c
|
@ -1863,19 +1863,19 @@ print_report(const char *format, ...)
|
||||||
integer = va_arg(ap, int);
|
integer = va_arg(ap, int);
|
||||||
switch (integer) {
|
switch (integer) {
|
||||||
case LEAP_Normal:
|
case LEAP_Normal:
|
||||||
string = "Normal";
|
string = width != 1 ? "Normal" : "N";
|
||||||
break;
|
break;
|
||||||
case LEAP_InsertSecond:
|
case LEAP_InsertSecond:
|
||||||
string = "Insert second";
|
string = width != 1 ? "Insert second" : "+";
|
||||||
break;
|
break;
|
||||||
case LEAP_DeleteSecond:
|
case LEAP_DeleteSecond:
|
||||||
string = "Delete second";
|
string = width != 1 ? "Delete second" : "-";
|
||||||
break;
|
break;
|
||||||
case LEAP_Unsynchronised:
|
case LEAP_Unsynchronised:
|
||||||
string = "Not synchronised";
|
string = width != 1 ? "Not synchronised" : "?";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
string = "Invalid";
|
string = width != 1 ? "Invalid" : "?";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("%s", string);
|
printf("%s", string);
|
||||||
|
@ -2557,9 +2557,9 @@ process_cmd_selectdata(char *line)
|
||||||
printf( "| | | | |\n");
|
printf( "| | | | |\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
print_header("S Name/IP Address Auth COpts EOpts Last Score Interval ");
|
print_header("S Name/IP Address Auth COpts EOpts Last Score Interval Leap");
|
||||||
|
|
||||||
/* "S NNNNNNNNNNNNNNNNNNNNNNNNN A OOOO- OOOO- LLLL SSSSS LLLLLLL LLLLLLL" */
|
/* "S NNNNNNNNNNNNNNNNNNNNNNNNN A OOOO- OOOO- LLLL SSSSS IIIIIII IIIIIII L" */
|
||||||
|
|
||||||
for (i = 0; i < n_sources; i++) {
|
for (i = 0; i < n_sources; i++) {
|
||||||
request.command = htons(REQ_SELECT_DATA);
|
request.command = htons(REQ_SELECT_DATA);
|
||||||
|
@ -2577,7 +2577,7 @@ process_cmd_selectdata(char *line)
|
||||||
conf_options = ntohs(reply.data.select_data.conf_options);
|
conf_options = ntohs(reply.data.select_data.conf_options);
|
||||||
eff_options = ntohs(reply.data.select_data.eff_options);
|
eff_options = ntohs(reply.data.select_data.eff_options);
|
||||||
|
|
||||||
print_report("%c %-25s %c %c%c%c%c%c %c%c%c%c%c %I %5.1f %+S %+S\n",
|
print_report("%c %-25s %c %c%c%c%c%c %c%c%c%c%c %I %5.1f %+S %+S %1L\n",
|
||||||
reply.data.select_data.state_char,
|
reply.data.select_data.state_char,
|
||||||
name,
|
name,
|
||||||
reply.data.select_data.authentication ? 'Y' : 'N',
|
reply.data.select_data.authentication ? 'Y' : 'N',
|
||||||
|
@ -2595,6 +2595,7 @@ process_cmd_selectdata(char *line)
|
||||||
UTI_FloatNetworkToHost(reply.data.select_data.score),
|
UTI_FloatNetworkToHost(reply.data.select_data.score),
|
||||||
UTI_FloatNetworkToHost(reply.data.select_data.lo_limit),
|
UTI_FloatNetworkToHost(reply.data.select_data.lo_limit),
|
||||||
UTI_FloatNetworkToHost(reply.data.select_data.hi_limit),
|
UTI_FloatNetworkToHost(reply.data.select_data.hi_limit),
|
||||||
|
reply.data.select_data.leap,
|
||||||
REPORT_END);
|
REPORT_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
cmdmon.c
1
cmdmon.c
|
@ -1327,6 +1327,7 @@ handle_select_data(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||||
UTI_IPHostToNetwork(&report.ip_addr, &tx_message->data.select_data.ip_addr);
|
UTI_IPHostToNetwork(&report.ip_addr, &tx_message->data.select_data.ip_addr);
|
||||||
tx_message->data.select_data.state_char = report.state_char;
|
tx_message->data.select_data.state_char = report.state_char;
|
||||||
tx_message->data.select_data.authentication = report.authentication;
|
tx_message->data.select_data.authentication = report.authentication;
|
||||||
|
tx_message->data.select_data.leap = report.leap;
|
||||||
tx_message->data.select_data.conf_options = htons(convert_select_options(report.conf_options));
|
tx_message->data.select_data.conf_options = htons(convert_select_options(report.conf_options));
|
||||||
tx_message->data.select_data.eff_options = htons(convert_select_options(report.eff_options));
|
tx_message->data.select_data.eff_options = htons(convert_select_options(report.eff_options));
|
||||||
tx_message->data.select_data.last_sample_ago = htonl(report.last_sample_ago);
|
tx_message->data.select_data.last_sample_ago = htonl(report.last_sample_ago);
|
||||||
|
|
|
@ -432,11 +432,11 @@ lines are shown as a reminder of the meanings of the columns.
|
||||||
An example of the output is shown below.
|
An example of the output is shown below.
|
||||||
+
|
+
|
||||||
----
|
----
|
||||||
S Name/IP Address Auth COpts EOpts Last Score Interval
|
S Name/IP Address Auth COpts EOpts Last Score Interval Leap
|
||||||
====================================================================
|
=======================================================================
|
||||||
D foo.example.net Y ----- --TR- 4 1.0 -61ms +62ms
|
D foo.example.net Y ----- --TR- 4 1.0 -61ms +62ms N
|
||||||
* bar.example.net N ----- ----- 0 1.0 -6846us +7305us
|
* bar.example.net N ----- ----- 0 1.0 -6846us +7305us N
|
||||||
+ baz.example.net N ----- ----- 10 1.0 -7381us +7355us
|
+ baz.example.net N ----- ----- 10 1.0 -7381us +7355us N
|
||||||
----
|
----
|
||||||
+
|
+
|
||||||
The columns are as follows:
|
The columns are as follows:
|
||||||
|
@ -508,6 +508,12 @@ be reselected and the scores will be reset to 1.
|
||||||
This column displays the lower and upper endpoint of the interval which was
|
This column displays the lower and upper endpoint of the interval which was
|
||||||
expected to contain the true offset of the local clock considering the root
|
expected to contain the true offset of the local clock considering the root
|
||||||
distance at the time of the selection.
|
distance at the time of the selection.
|
||||||
|
*Leap*:::
|
||||||
|
This column displays the current leap status of the source.
|
||||||
|
* _N_ indicates the normal status (no leap second).
|
||||||
|
* _+_ indicates that a leap second will be inserted at the end of the month.
|
||||||
|
* _-_ indicates that a leap second will be deleted at the end of the month.
|
||||||
|
* _?_ indicates the unknown status (i.e. no valid measurement was made).
|
||||||
|
|
||||||
[[reselect]]*reselect*::
|
[[reselect]]*reselect*::
|
||||||
To avoid excessive switching between sources, *chronyd* can stay synchronised
|
To avoid excessive switching between sources, *chronyd* can stay synchronised
|
||||||
|
|
|
@ -190,6 +190,7 @@ typedef struct {
|
||||||
IPAddr ip_addr;
|
IPAddr ip_addr;
|
||||||
char state_char;
|
char state_char;
|
||||||
int authentication;
|
int authentication;
|
||||||
|
NTP_Leap leap;
|
||||||
int conf_options;
|
int conf_options;
|
||||||
int eff_options;
|
int eff_options;
|
||||||
uint32_t last_sample_ago;
|
uint32_t last_sample_ago;
|
||||||
|
|
|
@ -1610,6 +1610,7 @@ SRC_GetSelectReport(int index, RPT_SelectReport *report)
|
||||||
report->ip_addr.family = IPADDR_UNSPEC;
|
report->ip_addr.family = IPADDR_UNSPEC;
|
||||||
report->state_char = get_status_char(inst->status);
|
report->state_char = get_status_char(inst->status);
|
||||||
report->authentication = inst->authenticated;
|
report->authentication = inst->authenticated;
|
||||||
|
report->leap = inst->leap;
|
||||||
report->conf_options = inst->conf_sel_options;
|
report->conf_options = inst->conf_sel_options;
|
||||||
report->eff_options = inst->sel_options;
|
report->eff_options = inst->sel_options;
|
||||||
report->last_sample_ago = inst->sel_info.last_sample_ago;
|
report->last_sample_ago = inst->sel_info.last_sample_ago;
|
||||||
|
|
|
@ -96,9 +96,9 @@ Total RX : [0-9]+
|
||||||
Total valid RX : [0-9]+$" || test_fail
|
Total valid RX : [0-9]+$" || test_fail
|
||||||
|
|
||||||
run_chronyc "selectdata" || test_fail
|
run_chronyc "selectdata" || test_fail
|
||||||
check_chronyc_output "^S Name/IP Address Auth COpts EOpts Last Score Interval +
|
check_chronyc_output "^S Name/IP Address Auth COpts EOpts Last Score Interval Leap
|
||||||
====================================================================
|
=======================================================================
|
||||||
M 127\.0\.0\.1 N ----- ----- 0 1\.0 \+0ns \+0ns$" || test_fail
|
M 127\.0\.0\.1 N ----- ----- 0 1\.0 \+0ns \+0ns \?$" || test_fail
|
||||||
|
|
||||||
run_chronyc "serverstats" || test_fail
|
run_chronyc "serverstats" || test_fail
|
||||||
check_chronyc_output "^NTP packets received : [0-9]+
|
check_chronyc_output "^NTP packets received : [0-9]+
|
||||||
|
|
Loading…
Reference in a new issue