This plugin provides native network time protocol (NTP) instrumentation for monitoring and metrics collection, including server drift and metrics via ntpdate
and ntpstats
.
- 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 jitterclk_wander
: Clock frequency wanderfrequency
: Frequency offset relative to hardware clockmintc
: Minimum time constantoffset
: Combined offset of server relative to this hoststratum
: Stratumsys_jitter
: Combined system jittertc
: Time constant and poll exponent
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
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.
---
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
---
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
{
"checks": {
"check-ntp": {
"command": "check-ntp.rb",
"subscribers": ["linux"],
"interval": 10,
"refresh": 10,
"handlers": ["influxdb"]
}
}
}
See the instructions above for asset registration.
Install and setup plugins on Sensu Core.
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.
See CONTRIBUTING.md for information about contributing to this plugin.