In /var/log/ntpstats/peerstats you see lines like (I put them in table form for readability - normally space delimited)
|Day||Seconds||Peer IP||Peer Status Word||Offset||Delay||Dispersion||Skew (variance)|
Decoding Peer Status Word
The Peer Status Word is a multi-byte disaster which represents things to NTP. Normally ntpq -c “associations” shows you this in english but to debug you need to look at the peerstats file which does not reveal.
Decoding the first byte
Using the table below you get the value. For instance 9XXX status means 10+80 (reachable and configured in ntp.conf). 8XXX means It is configured but it is not reachable (80).
Decoding the second byte
Given 96XX the host is reachable and configured (as seen above) the second byte from the table below means it is the system peer (you will also see a * next to it in ntpq -p)
Another example from the sample above is "8023" this means it is configured but it is NOT reachable and it is discarded (see bolded 0 meaning sel_reject)
|0||sel_reject||discarded as not valid (TEST10-TEST13)|
|1||sel_falsetick||x||discarded by intersection algorithm|
|2||sel_excess||.||discarded by table overflow (not used)|
|3||sel_outlyer||-||discarded by the cluster algorithm|
|4||sel_candidate||+||included by the combine algorithm|
|5||sel_backup||#||backup (more than tos maxclock sources)|
|7||sel_pps.peer||o||PPS peer (when the prefer peer is valid)|
Decoding the third and fourth byte
The third byte is the count of occurrences of the 4th byte (event code) and yes that seems backwards to normal thought
The fourth byte as seen below is the event code which is counted by the third byte.
Given the example of "941a" from above we know its configured and reachable its a candidate and there has been one occurrence of becoming a system peer (1 times of a)
Another example is "8023" from above we know its configured but its unreachable and there has been two occurrences of it being unreachable (2 times of 3).
|06||no_reply||no server found (ntpdate mode)|
|07||rate_exceeded||rate exceeded (kiss code RATE)|
|08||access_denied||access denied (kiss code DENY)|
|09||leap_armed||leap armed from server LI code|
|0a||sys_peer||become system peer|
|0b||clock_event||see clock status word|
|0d||popcorn||popcorn spike suppressor|
|0e||interleave_mode||entering interleave mode|
|0f||interleave_error||interleave error (recovered)|