check_ntp_offset
Checks the NTP offset.
Implementation
| Windows | Linux | FreeBSD | macOS |
|---|
| ✅ | ✅ | ✅ | ✅ |
Argument Defaults
| Argument | Default Value |
|---|
| filter | none |
| warning | offset > 50 || offset < -50 |
| critical | offset > 100 || offset < -100 |
| empty-state | 3 (UNKNOWN) |
| empty-syntax | %(status) - could not get any ntp data |
| top-syntax | %(status) - %(list) |
| ok-syntax | |
| detail-syntax | offset %(offset_seconds:duration) from %(server) |
Check Specific Arguments
| Argument | Description |
|---|
| server | Fetch the offset from these NTP servers. Uses the first valid response. |
| source | Choose the time data source instead of automatic detection. Valid values: auto, timedatectl, ntpq, chronyc, macos, w32time, w32tm. |
Attributes
Filter Keywords
Use these attributes in filters and thresholds, along with the default attributes:
| Attribute | Description |
|---|
| source | Source of the NTP metrics |
| server | NTP server name |
| stratum | Stratum value (distance to root NTP server) |
| jitter | Jitter of the clock in milliseconds |
| offset | Time offset to the NTP server in milliseconds. SNClient adds this value as a metric. |
| offset_seconds | Time offset to the NTP server in seconds. SNClient does not add this value as a metric. SNClient converts thresholds from ‘offset_seconds’ to ‘offset’ without a message. |
| leap_indicator | NTP leap indicator: 0 no warning, 1 last minute has 61 seconds, 2 last minute has 59 seconds, 3 not synchronized. SNClient sets this value only for the w32time source. |
| state | Clock discipline state: 0 unset, 1 hold, 2 sync, 3 spike. SNClient sets this value only for the w32time source. |
| state_name | Name of the clock discipline state. w32tm shows this name. SNClient sets this value only for the w32time source. |
| last_sync_result | Result of the last synchronization: 0 success, 1 no data, 2 stale data, 3 change too big, 4 shutdown. SNClient sets this value only for the w32time source. |
| last_sync_result_name | Name of the last synchronization result. SNClient sets this value only for the w32time source. |
| root_delay | Round-trip delay to the primary time source in milliseconds. SNClient sets this value only for the w32time source. |
| root_dispersion | Maximum error relative to the primary time source in milliseconds. SNClient sets this value only for the w32time source. |
| last_sync | Time of the last successful synchronization as a Unix timestamp in seconds. SNClient sets this value only for the w32time source. |
Examples
Default Check
check_ntp_offset
OK - offset 2.1ms from 1.2.3.4 (debian.pool.ntp.org) |...
Example using check_snclient and Naemon
Naemon Config
define command{
command_name check_snclient
command_line $USER1$/check_snclient -k -p 'your-password' -u 'https://$HOSTADDRESS$:8443' $ARG1$ $ARG2$
}
define service {
host_name testhost
service_description check_ntp_offset
use generic-service
check_command check_snclient!check_ntp_offset!'warn=offset > 50 || offset < -50' 'crit=offset > 100 || offset < -100'
}