Linux
banshee/linux-collection/linux/ssh/
clock
Offset of a Linux clock from a time server: date by SSH against NTP.
by banshee1 installation2 versions
Clock of a Linux, by SSH
Returns the offset of the machine's clock from a time server, with and without its sign. Positive, the clock is ahead; negative, it is behind.
How it works
The collector runs date +%s on the machine (the seconds since 1 January 1970 UTC), then asks the time server named by protocol:ntp:server (pool.ntp.org when empty) with one NTP client request.
- The server's time is brought back to the middle of the SSH call, measured by the poller's clock: neither the SSH round trip nor the time between the two readings counts in the offset, nor the poller's own clock error.
datetruncates to the second: half a second is added, the middle of the second the true time lies in.- Portable:
date +%sis known by BusyBox and GNU coreutils, and gives UTC seconds with no time zone to guess. Nothing is written on the target.
Prerequisites
- an SSH account for monitoring, without write rights;
- the fingerprint of the server's host key, set in
protocol:ssh:fingerprint(not needed when the Security settings trust the first SSH fingerprint presented); - the poller reaching the time server on UDP port 123.
Outputs
| Output | Unit | Meaning |
|---|---|---|
offset | s | offset from the time server |
drift | s | the offset without its sign |
Watches
| Watch | Kind | Defaults | Checked |
|---|---|---|---|
clock-drift Clock off | above, on drift | warning 5, critical 60 | yes |
Limits
- The offset is read to about one second: the SSH call, connection included, is a second long at worst. The default thresholds stay far above it.
- A time server that does not answer stops the collector
unreachable.