Skip to content

Check ntp-systemd-timesyncd

Overview

Checks the state of systemd-timesyncd, including synchronization status, server reachability, and stratum level. Alerts if time synchronization is inactive or if the stratum exceeds the configured limit.

Important Notes:

  • The stratum of the NTP time source determines its quality. The stratum is equal to the number of hops to a reference clock (stratum 0). A NTP server connected directly to the reference clock is Stratum 1, a client connected to this NTP server is Stratum 2, etc.

Data Collection:

  • Executes timedatectl show-timesync --all to obtain the current synchronization status
  • Parses the NTP message to extract the stratum value
  • Displays the full timedatectl output including configured NTP servers, server name and address, root distance, poll intervals, NTP message details, and frequency

Fact Sheet

Fact Value
Check Plugin Download https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/ntp-systemd-timesyncd
Nagios/Icinga Check Name check_ntp_systemd_timesyncd
Check Interval Recommendation Every minute
Can be called without parameters Yes
Runs on Cross-platform
Compiled for Windows No (runs with Python interpreter)

Help

usage: ntp-systemd-timesyncd [-h] [-V] [--always-ok] [--no-perfdata]
                             [--stratum STRATUM]

Checks the state of systemd-timesyncd, including synchronization status,
server reachability, and stratum level. Alerts if time synchronization is
inactive or if the stratum exceeds the configured limit.

options:
  -h, --help         show this help message and exit
  -V, --version      show program's version number and exit
  --always-ok        Always returns OK.
  --no-perfdata      Suppress the performance data section from the output.
                     The status message and the exit code are unaffected, so
                     alerting keeps working while trending data is dropped.
  --stratum STRATUM  Warns if the determined stratum of the time server is
                     greater than or equal to this value. Stratum 1 indicates
                     a computer with a locally attached reference clock. A
                     computer that is synchronised to a stratum 1 computer is
                     at stratum 2. A computer that is synchronised to a
                     stratum 2 computer is at stratum 3, and so on. Default: 6

Documentation:
https://linuxfabrik.github.io/monitoring-plugins/check-plugins/ntp-systemd-timesyncd/

Usage Examples

./ntp-systemd-timesyncd --stratum=6

Output:

Stratum is 2

LinkNTPServers=
SystemNTPServers=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
FallbackNTPServers=0.pool.ntp.org 1.pool.ntp.org 0.fr.pool.ntp.org
ServerName=0.arch.pool.ntp.org
ServerAddress=46.22.24.205
RootDistanceMaxUSec=5s
PollIntervalMinUSec=32s
PollIntervalMaxUSec=34min 8s
PollIntervalUSec=34min 8s
NTPMessage={ Leap=0, Version=4, Mode=4, Stratum=2, Precision=-26, RootDelay=4.364ms, RootDispersion=534us, Reference=C3B01ACD, OriginateTimestamp=Sun 2022-08-07 10:09:44 UTC, ReceiveTimestamp=Sun 2022-08-07 10:09:44 UTC, TransmitTimestamp=Sun 2022-08-07 10:09:44 UTC, DestinationTimestamp=Sun 2022-08-07 10:09:44 UTC, Ignored=no PacketCount=6, Jitter=22.804ms }
Frequency=-1365573

States

  • OK if the stratum is below the configured limit and an NTP server is in use.
  • WARN if stratum is >= --stratum (default: 6).
  • WARN if no NTP server is used.

Perfdata / Metrics

Name Type Description
stratum Number Stratum of the currently used NTP server.

Troubleshooting

systemd-timesyncd is not available on this host

timedatectl could not reach systemd-timesyncd. A stopped service is started on demand, so it is either not installed (minimal Debian installations come without it, and the Red Hat family keeps time with chronyd) or masked. The raw error in parentheses depends on the systemd version, for example Failed to parse bus message: No route to host or File exists (masked). Install and enable systemd-timesyncd, or, on a host that keeps its time with chronyd, use the ntp-chronyd check instead.

No NTP server used.

This message occurs when systemd-timesyncd is running but does not currently use any NTP server.

Credits, License