Linux
banshee/linux-collection/linux/snmp/
clock
Offset of a Linux host's clock from a time server, read by SNMP and compared by NTP.
par banshee1 installation2 versions
Clock of a Linux host, by SNMP
Returns the offset of the host's clock from a time server, with and without its sign, in seconds. One watch is offered: the clock drift.
How it works
The collector reads the system time, hrSystemDate (HOST-RESOURCES-MIB), by SNMP, and asks a time server for its time by NTP (pool.ntp.org when the "Time server" variable is unset).
- The server's time is brought back to the middle of the SNMP read: neither the SNMP round trip, nor the time between the two reads, nor the error of the poller's own clock counts in the offset.
- A positive offset means the host's clock is ahead; negative, behind.
- An agent that serves the date without its offset from UTC does not say which instant it is: the collector then stops as misconfigured rather than guess. net-snmp serves the offset.
- A time server that does not answer stops the collector as unreachable.
Prerequisites
snmpd(net-snmp) running on the host, listening on an address the poller reaches (UDP 161), with the firewall open to the poller only.- The view granted to the poller includes
hrSystem(.1.3.6.1.2.1.25.1), which most default configurations already allow. - Read-only access, SNMPv2c or SNMPv3, set on the host or one of its folders (
protocol:snmp:*variables). - The poller reaches the time server on UDP 123 (
protocol:ntp:server,protocol:ntp:timeout).
# /etc/snmp/snmpd.conf
agentaddress udp:161
view banshee included .1.3.6.1.2.1.25.1
rocommunity <community> 192.0.2.10 -V banshee
# or: rouser <user> priv -V banshee Outputs
| Name | Label | Unit |
|---|---|---|
offset | Offset from the time server | s |
drift | Offset, without its sign | s |
Watches
| Watch | Kind | Defaults | Checked |
|---|---|---|---|
| Clock drift | Above a threshold, on drift | warning 5 s, critical 60 s | yes |
Limits
hrSystemDateis only precise to a tenth of a second: an offset below that is noise.- The collector measures the offset; it does not say whether the host synchronises its clock (chrony, systemd-timesyncd).