Monitoring time synchronization without Daemon (Chrony)

When configuring time sync over YaST2 on SLES there is the option to “Synchronize without Daemon”.

Ultimately this results in chrony being started via cron. Information is logged under the yast-timesync.service, output for example looks like this:

### Failing to start chrony
Dec 21 12:20:03 example-sles systemd[1]: Starting One time sync configured by YaST...
Dec 21 12:20:03 example-sles systemd[1]: yast-timesync.service: Main process exited, code=exited, status=1/FAILURE
Dec 21 12:20:03 example-sles systemd[1]: yast-timesync.service: Failed with result 'exit-code'.
Dec 21 12:20:03 example-sles systemd[1]: Failed to start One time sync configured by YaST.

# Working
Dec 21 12:35:03 example-sles systemd[1]: Starting One time sync configured by YaST...
Dec 21 12:35:03 example-sles yast-timesync[8238]: 2022-12-21T11:35:03Z chronyd version 4.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG)
Dec 21 12:35:03 example-sles yast-timesync[8238]: 2022-12-21T11:35:03Z Initial frequency -81.568 ppm
Dec 21 12:35:08 example-sles yast-timesync[8238]: 2022-12-21T11:35:08Z System clock wrong by 0.000489 seconds (step)
Dec 21 12:35:08 example-sles yast-timesync[8238]: 2022-12-21T11:35:08Z chronyd exiting
Dec 21 12:35:08 example-sles systemd[1]: yast-timesync.service: Succeeded.
Dec 21 12:35:08 example-sles systemd[1]: Finished One time sync configured by YaST.

Now I am wondering if this daemon-less approach is possible to monitor?

Per default Checkmk will create a service configuration named “NTP Time” which has a status detail (CRIT) of “506 Cannot talk to daemon”. This is expected since Checkmk uses chronyc tracking and no daemon is running.

Not familiar with the yast2 approach here, but judging from your log extracts I would say you can create a logwatch rule to create an alert when “Failed to start One time sync” appears

or you go one step further and forward the yast-timesync lines from the “working” log entries and create an Event console rule to expect a successful sync every hour (or every day) depending on the way yast defines it.

You could also use the Nagios plugin “check_ntp_time” (included with Checkmk and also available from the “monitoring plugins” collection) to check the host’s time against any time server:

$ /usr/lib/nagios/plugins/check_ntp_time -H 0.debian.pool.ntp.org
NTP OK: Offset -0.0003226101398 secs|offset=-0.000323s;60.000000;120.000000;
$

This can be configured as an MRPE check.

Maybe this helps?

FYI @thl-cmk

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.