This article addresses two questions. The first one is: How can I force a time synchronization poll? And the second one is: How can I verify if the NTP-daemon is actually synchronizing with an NTP-server?
I have not found a command to force synchronization (if you know of one please let me know). But a way to do this is to restart the NTP-daemon, once it is loaded it will start with an initial poll and then remains running. To restart the daemon from the ESXi command line run this command:
/etc/init.d/ntpd restart
Once the NTP synchronization has started you can query the status with the command ntpq -p as in the image below.
Reach-value explained
The value in the reach-column represents the success and failure of the past eight polls to the NTP-server. It is a bit-shift register, which means that bits are added to the right. This moves the previous bits to the left where the left-most bit is dropped.
0 means the NTP server was not contacted, 1 means a successful synchronization. The reach-value is not binary but it is also not decimal, it is an octal value.
To understand this value we first look into the binary to octal conversion table below.
binary |
octal |
---|---|
00000001 |
1 |
00000011 |
3 |
00000111 |
7 |
00001111 |
17 |
00011111 |
37 |
00111111 |
77 |
01111111 |
177 |
11111111 |
377 |
When we look at this table and know that 1 means successful synchronization (all ones) then a value of 377 means that the last eight polls were successful. When the NTP daemon starts it does one poll and if it is successful the reach-value is 1, next a bit is added to the right (11), which means 3, after a next successful poll it is 7 and so on. Let's have a look at an example of when we have missed a poll. In the image below you can see that we have missed a poll when checking the ntp daemon status each 128 seconds.
In the image the first value is 376, which means that a 0 was added to the right, (11111110). That unsuccessful poll will shift to the left with the next polls, which were successful. In this table you can see the bit-shift happening:
11111110 376
11111101 375
11111011 373
This continues and when all eight polls were successful again the value will become 377.
I hope this article helps understanding how to check what your NTP daemon is doing on your ESXi server. With thanks to my students Emiel and Walter of the FastTrack in October 2013 who came up with the question and the direction for this answer.