This kb outlines the steps to configure NTP loopstats and peerstats to troubleshoot NTP synchronisation issues. These steps are extremely helpful when a user wishes to monitor and export the NTP statistics for a certain duration (for example a day or two) to confirm the behavior of NTP peers throughout the said period.
Loopstats and Peerstats are NTP (Network Time Protocol) logging options used for troubleshooting the time synchronization process. While loopstats records statistics on the server's internal clock discipline, peerstats records synchronization statistics for each individual NTP peer the server is communicating with, including offset, delay, and status. Both are enabled in the ntp.conf file using the statistics command and can be essential for diagnosing NTP related issues.
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x
mkdir -p /var/log/ntp/
cp /etc/ntp.conf /etc/ntp.conf.bak && echo "statistics loopstats statsdir /var/log/ntp/ filegen peerstats file peers type day link enable filegen loopstats file loops type day link enable" >> /etc/ntp.conf.bak
esxcli system ntp set -f /etc/ntp.conf.bak && esxcli system ntp set -e 1