check_ntp_offset

Checks the NTP offset.

Implementation

WindowsLinuxFreeBSDmacOS
✅✅✅✅

Argument Defaults

ArgumentDefault Value
filternone
warningoffset > 50 || offset < -50
criticaloffset > 100 || offset < -100
empty-state3 (UNKNOWN)
empty-syntax%(status) - could not get any ntp data
top-syntax%(status) - %(list)
ok-syntax
detail-syntaxoffset %(offset_seconds:duration) from %(server)

Check Specific Arguments

ArgumentDescription
serverFetch the offset from these NTP servers. Uses the first valid response.
sourceChoose 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:

AttributeDescription
sourceSource of the NTP metrics
serverNTP server name
stratumStratum value (distance to root NTP server)
jitterJitter of the clock in milliseconds
offsetTime offset to the NTP server in milliseconds. SNClient adds this value as a metric.
offset_secondsTime 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_indicatorNTP 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.
stateClock discipline state: 0 unset, 1 hold, 2 sync, 3 spike. SNClient sets this value only for the w32time source.
state_nameName of the clock discipline state. w32tm shows this name. SNClient sets this value only for the w32time source.
last_sync_resultResult 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_nameName of the last synchronization result. SNClient sets this value only for the w32time source.
root_delayRound-trip delay to the primary time source in milliseconds. SNClient sets this value only for the w32time source.
root_dispersionMaximum error relative to the primary time source in milliseconds. SNClient sets this value only for the w32time source.
last_syncTime 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'
}