Score:0

NTP Debian: how do I know, if the last poll was successfull

cn flag

I've got the task to write an application, that supports NTP communication. Everything works fine so far, but I need to know, if the last ntp poll was successful or not.

When I pull out the network cable, ntpstat even tells me even in the next morning, that everything was fine. But there was no NTP communication the whole night...

Have you got any ideas?

Thank you!

Pinging is not a good solution, bc response could be turned off by the server or the server is reachable, but the ntp daemon is not running.

Score:0
cn flag

Found it myself.

ntpq -pn has a column "reach", that decreases, if the polls do not succeed

Score:0
cn flag

Most applications do not care that every NTP packet arrived. UDP over IP can be lossy occasionally, it happens. ntpd continues on and keeps adjusting based on last known offset and drift. Actually, most applications don't care about time sync at all. The few that do might wait at boot until ntpd (or chronyd) started.

One open source monitoring script that has reach thresholds is ntpmon. For reference, it considers 75% to all ntp sources successful. So, 6 of the 8 last packets, given reach is an 8 bit number. This plus offset thresholds makes for a host metric for infrastructure monitoring.

ntpstat probably refers to the shell script ntpstat (replacing an earlier program). Which will print out a source and estimated error. And only exits with a non-zero return code in specific cases, like the NTP daemon not running. ntpstat does not alert on reach, whether intentional to support disconnected use cases, or that feature never got implemented, I do not know.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.