Skip to content

NTP

The ntp health check will send a NTP query and optionally validate that the server offset and stratum value is within the supplied parameters.

Configuration Keys

The following configuration options apply to the NTP health check method:

Key Type Default
port Integer 123
version Integer 2
ntp_timeout Integer/Float 5
max_offset Optional Integer/Float undef
max_stratum Optional Integer undef

Remote Check Options

As this is a remote check, the following additional options are supported:

Key Type Default
host String undef
address_family Optional String undef
all_valid Bool False
Host

The host field contains the IP address or hostname that the health check should be executed against. If a hostname is supplied, each health check execution will perform a DNS resolution to ensure the current IP is used.

As the hostname may resolve to multiple addresses and/or address families (eg. IPv4 and IPv6) the address_family and all_valid options can be used to control what happens in those situations.

Warning

If specifying a host name instead of an IP address, temporary DNS resolution errors will cause the health check to fail. Specify an IP address to avoid this behaviour.

Address Family

The address_family key is used when host is set to a hostname. Should the hostname resolve to an IPv4 and IPv6 address you may want the check to only be sent to a single address family rather than both.

The values ipv4 or ipv6 are supported. If not defined there is no filtering for IPv4 or IPv6 addresses applied.

All Valid

The all_valid key is used when host is set to a hostname. If the hostname resolves to multiple IP addresses and all_valid is set to True, the health check will be executed against all IP addresses available. Should the health check to any IP address fail the service will be marked as down.

If set to the default False value a successful health check from any IP address is considered valid and the service will be marked up.

Port

By default, the port value is set to the well known port value 123. If the NTP server is listening on a different port change this port to match.

Version

Version 2 NTP queries are sent by default for the health check. Support version values are:

  • 2
  • 3

NTP Timeout

The ntp_timeout option determines how long the NTP request is allowed to wait for a response.

Max Offset

The max_offset value can be used to ensure the time contained within the NTP response is within a certain offset.

Max Stratum

The max_stratum value can be used to ensure the NTP server is within a certain stratum value. Valid options are integers between 1 to 15.

Examples

These are some configuration examples for the NTP health check:

To send a NTP query and validate there is a response:

---

# The list of health checks
checks:

  - name: Example Basic NTP Check
    description: Ensure that the IP 192.0.2.123 responds to NTP queries
    args:
      method: ntp
      host: 192.0.2.123
    prefixes:
      - 192.0.2.255
    nexthop: self

To ensure the NTP server is at least stratum 2:

---

# The list of health checks
checks:

  - name: Example NTP Stratum Check
    description: Ensure that the IP 2001:db8::123 responds to NTP queries and the server is at least stratum 2
    args:
      method: ntp
      host: 2001:db8::123
      max_stratum: 2
    prefixes:
      - 2001:db8:aaaa::ffff/128
      - 2001:db8:aaaa::123/128
    nexthop: self