Feature #8794 » status_ntpd.php.auth.patch
| /usr/local/www/status_ntpd.php 2023-02-25 07:37:38.947966000 -0500 | ||
|---|---|---|
|
$inet_version = " -4";
|
||
|
}
|
||
|
exec('/usr/local/sbin/ntpq -pnw ' . $inet_version . ' | /usr/bin/tail +3 | /usr/bin/awk -v RS= \'{gsub(/\n[[:space:]][[:space:]]+/," ")}1\'', $ntpq_output);
|
||
|
exec('/usr/local/sbin/ntpq -pnw' . $inet_version . ' | /usr/bin/tail +3 | /usr/bin/awk -v RS= \'{gsub(/\n[[:space:]][[:space:]]+/," ")}1\'', $ntpq_output);
|
||
|
exec('/usr/local/sbin/ntpq -c associations' . $inet_version . ' | /usr/bin/tail +3 | /usr/bin/awk -v RS= \'{gsub(/\n[[:space:]][[:space:]]\n+/," ")}1\'', $ntpq_associations_output);
|
||
|
$ntpq_servers = array();
|
||
|
$ntpq_server_responses = array();
|
||
|
$i = 0;
|
||
|
foreach ($ntpq_associations_output as $line) {
|
||
|
$associations_response = array();
|
||
|
$peerinfo = preg_split("/[\s\t]+/", $line);
|
||
|
|
||
|
$server['ind'] = $peerinfo[1];
|
||
|
$associations_response['assid'] = $peerinfo[2];
|
||
|
$associations_response['status_word'] = $peerinfo[3];
|
||
|
$associations_response['conf'] = $peerinfo[4];
|
||
|
$associations_response['reach'] = $peerinfo[5];
|
||
|
$associations_response['auth'] = $peerinfo[6];
|
||
|
$associations_response['condition'] = $peerinfo[7];
|
||
|
$associations_response['last_event'] = $peerinfo[8];
|
||
|
$associations_response['cnt'] = $peerinfo[9];
|
||
|
$ntpq_server_responses[$i] = $associations_response;
|
||
|
$i = $i +1;
|
||
|
}
|
||
|
|
||
|
$i = 0;
|
||
|
foreach ($ntpq_output as $line) {
|
||
|
$server = array();
|
||
|
$status_char = substr($line, 0, 1);
|
||
| ... | ... | |
|
$server['offset'] = $peerinfo[8];
|
||
|
$server['jitter'] = $peerinfo[9];
|
||
|
$server['ind'] = $ntpq_server_responses[$i]['ind'];
|
||
|
$server['assid'] = $ntpq_server_responses[$i]['assid'];
|
||
|
$server['status_word'] = $ntpq_server_responses[$i]['status_word'];
|
||
|
$server['conf'] = $ntpq_server_responses[$i]['conf'];
|
||
|
$server['auth'] = $ntpq_server_responses[$i]['auth'];
|
||
|
$server['condition'] = $ntpq_server_responses[$i]['condition'];
|
||
|
$server['last_event'] = $ntpq_server_responses[$i]['last_event'];
|
||
|
$server['cnt'] = $ntpq_server_responses[$i]['cnt'];
|
||
|
|
||
|
switch ($status_char) {
|
||
|
case " ":
|
||
|
if ($server['refid'] == ".POOL.") {
|
||
| ... | ... | |
|
}
|
||
|
$ntpq_servers[] = $server;
|
||
|
$i = $i + 1;
|
||
|
}
|
||
|
exec("/usr/local/sbin/ntpq -c clockvar $inet_version", $ntpq_clockvar_output);
|
||
| ... | ... | |
|
}
|
||
|
function print_status() {
|
||
|
global $ntpq_servers, $allow_query;
|
||
|
global $ntpq_servers, $allow_query, $ntpq_server_responses;
|
||
|
if (config_get_path('ntpd/enable') == 'disabled'):
|
||
|
print("<tr>\n");
|
||
| ... | ... | |
|
print("<td>" . $server['delay'] . "</td>\n");
|
||
|
print("<td>" . $server['offset'] . "</td>\n");
|
||
|
print("<td>" . $server['jitter'] . "</td>\n");
|
||
|
print("<td>" . $server['assid'] . "</td>\n");
|
||
|
print("<td>" . $server['status_word'] . "</td>\n");
|
||
|
print("<td>" . $server['auth'] . "</td>\n");
|
||
|
print("</tr>\n");
|
||
|
$i++;
|
||
|
endforeach;
|
||
| ... | ... | |
|
<th><?=gettext("Delay (ms)")?></th>
|
||
|
<th><?=gettext("Offset (ms)")?></th>
|
||
|
<th><?=gettext("Jitter (ms)")?></th>
|
||
|
<th><?=gettext("AssocID")?></th>
|
||
|
<th><?=gettext("Status Word")?></th>
|
||
|
<th><?=gettext("Auth")?></th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody id="ntpbody">
|
||