No release in over 3 years
Low commit activity in last 3 years
There's a lot of open issues
This plugin provides native NTP instrumentation for monitoring and metrics collection, including: server drift, and metrics via `ntpdate` and `ntpstats`.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

~> 1.7
~> 0.10
~> 12.3
~> 3.2
~> 3.4
~> 0.40.0
~> 0.8

Runtime

 Project Readme

Sensu Bonsai Asset Build Status Gem Version Code Climate Test Coverage Dependency Status

Sensu Plugins NTP Plugin

  • Overview
  • Files
  • Usage examples
  • Configuration
    • Sensu Go
      • Asset registration
      • Asset definition
      • Check definition
    • Sensu Core
      • Check definition
  • Installation from source
  • Additional notes
  • Contributing

Overview

This plugin provides native network time protocol (NTP) instrumentation for monitoring and metrics collection, including server drift and metrics via ntpdate and ntpstats.

Files

  • check-ntp.rb
  • metrics-ntpdate.rb
  • metrics-ntpstats.rb

check-ntp Checks the synchronization state of the local NTP server.

  • Parameters:
    • warn: Maximum offset in ms for warning state (default: 10)
    • crit: Maximum offset in ms for critical state (default: 100)
    • stratum: Maximum stratum value (default: 15)
    • unsynced_status: Default status when unsynced (default: UNKNOWN)

metrics-ntpdate Gets metrics from ntpdate.

  • Parameters:

    • server: Comma-separated list of NTP server(s) to measure (default: localhost)
    • scheme: Prefix for metrics (default: hostname)
  • Values:

    • offset: Time difference between server and source (unit: ms)
    • delay: Roundtrip time from server to source (unit: ms)

metrics-ntpstats Gets metrics from ntpstats.

  • Parameters:

    • host: Target host (default: localhost)
    • scheme: Prefix for metrics (default: hostname)
  • Values (descriptions from https://www.eecis.udel.edu/~mills/ntp/html/ntpq.html):

    • clk_jitter: Clock jitter
    • clk_wander: Clock frequency wander
    • frequency: Frequency offset relative to hardware clock
    • mintc: Minimum time constant
    • offset: Combined offset of server relative to this host
    • stratum: Stratum
    • sys_jitter: Combined system jitter
    • tc: Time constant and poll exponent

Usage examples

Help

check-ntp.rb

Usage: check-ntp.rb (options)
    -c CRIT
    -s STRATUM                       check that stratum meets or exceeds desired value
    -u CODE                          If ntp_status is unsynced (that is, not yet connected to or disconnected from ntp), what should the response be.
    -w WARN

metrics-ntpdate.rb

Usage: metrics-ntpdate.rb (options)
    -s, --scheme SCHEME              Metric naming scheme, text to prepend to metric
        --server SERVER1[,SERVER2,..]
                                     NTP server(s)

metrics-ntpstats.rb

Usage: metrics-ntpstats.rb (options)
    -h, --host HOST                  Target host
    -s, --scheme SCHEME              Metric naming scheme, text to prepend to metric

Configuration

Sensu Go

Asset registration

Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset:

sensuctl asset add sensu-plugins/sensu-plugins-ntp

If you're using an earlier version of sensuctl, you can download the asset definition from this project's Bonsai asset index page.

Asset definition

---
type: Asset
api_version: core/v2
metadata:
  name: sensu-plugins-ntp
spec:
  url: https://assets.bonsai.sensu.io/a24eea423200374c5b7f96082dd7e315fc1ea814/sensu-plugins-ntp_2.0.0_centos_linux_amd64.tar.gz
  sha512: 3ee7b68d91798775f70ee9cd037f98a82386ae9beccd069a4db262d6b69ef49db65a1415cc40c2a6c8726447f0cf4978a332968edf132cd79805ce4f68889a5a

Check definition

---
type: CheckConfig
spec:
  command: "check-ntp.rb"
  handlers: []
  high_flap_threshold: 0
  interval: 10
  low_flap_threshold: 0
  publish: true
  runtime_assets:
  - sensu-plugins/sensu-plugins-ntp
  - sensu/sensu-ruby-runtime
  subscriptions:
  - linux

Sensu Core

Check definition

{
  "checks": {
    "check-ntp": {
      "command": "check-ntp.rb",
      "subscribers": ["linux"],
      "interval": 10,
      "refresh": 10,
      "handlers": ["influxdb"]
    }
  }
}

Installation from source

Sensu Go

See the instructions above for asset registration.

Sensu Core

Install and setup plugins on Sensu Core.

Additional notes

Sensu Go Ruby Runtime Assets

The Sensu assets packaged from this repository are built against the Sensu Ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator, or handler), make sure to include the corresponding Sensu Ruby Runtime Asset in the list of assets needed by the resource.

Contributing

See CONTRIBUTING.md for information about contributing to this plugin.