diff --git a/.travis.yml b/.travis.yml index f0f9937..b6bfa62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,5 +25,13 @@ deploy: on: tags: true all_branches: true - rvm: 2.3.0 - rvm: 2.4.1 \ No newline at end of file + rvm: 2.4.1 + - provider: rubygems + api_key: + secure: Belk8rDqJbAISGNyULiLYf6IVRBNvQ4BxYI3dT5pzeWL3DIUTdUVnXRGRAonhhxAQhZ38ldfarZanTeYL4j51aWSK31IMV8hxpj0ZfNDs9eWeJ7xT7/Lq8uPB4Xpby+wHxV3MbBk3amE2CF5xrDxYrK4vek4h8lr+gbY9PuM73RQ9WmmOGeX131DDnFDjwqDiWQCzjmkIJq0lHAuj2Lts95SvuRx1dMDCD+2hyAaWWnZdpOutxDlIRKyZ/JxIyuLMGgFbgXVxOOiIwNfqMI1hFf8ZPVg5TuYAJfbnDwfBR2MzvFu560sFesIUmJM+QQjNYGhdHVdrlY1XFkIk98ekZetrAYgsbioz85DkCGHBPOFdtImUhlIVcSzvr8Gj9t2f2iQJSTPlgfUDtqJ+rra58or2pxZIiMwLHcntnOKMEn7h7l7AhNCD+UD5rg2kb06pkH+FmYozJzoa07DW+PnKYPM9TptHnsAcRTLVkr5/hJG/mw4rE+IMZa71dvdeq2yeuNBka2uL/95DjIQyia7xDwxu7P5LnBPxShF33dRpNXEn8maaVcivPC3yvtskbY5BfiLuAMHd/aBZS/SqX8fxoU2gZpWtYlAS261giNU16RNnaU6pQNj/zahnvZxJU7k67POm3UPVstDZ6xMDHYafE3bUmxmXfBOvRdev6xQzvc= + gem: sensu-plugins-chrony + on: + tags: true + all_branches: true + rvm: 2.4.1 + repo: sensu-plugins/sensu-plugins-chrony \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e9aee9..fee8e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,22 @@ This project adheres to [Semantic Versioning](http://semver.org/). This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md) ## [Unreleased] -## [1.0.2] - 2020-01-09 + + +## [4.0.0] - 2020-01-13 ### Fixed - Added sensu bonsai. +- Bumped bundler to 2.1 - Upgraded versions to make it build again. +### Breaking Changes +- Update minimum required ruby version to 2.3. Drop unsupported ruby versions. +- Bump `sensu-plugin` dependency from `~> 1.2` to `~> 4.0` you can read the changelog entries for [4.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#400---2018-02-17), [3.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#300---2018-12-04), and [2.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#v200---2017-03-29) + +### Added +- Travis build automation to generate Sensu Asset tarballs that can be used n conjunction with Sensu provided ruby runtime assets and the Bonsai Asset Index +- Require latest sensu-plugin for [Sensu Go support](https://github.com/sensu-plugins/sensu-plugin#sensu-go-enablement) + ## [1.0.1] - 2018-05-03 ### Fixed - Fixes "undefined method `empty?"` (@jwatroba) diff --git a/README.md b/README.md index d548542..3ff20af 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Sensu plugin for monitoring Chrony NTP - +[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-chrony) [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-chrony.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-chrony) [![Gem Version](https://badge.fury.io/rb/sensu-plugins-chrony.svg)](https://badge.fury.io/rb/sensu-plugins-chrony) [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-chrony/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-chrony) @@ -8,26 +8,32 @@ [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-chrony.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-chrony) [![Community Slack](https://slack.sensu.io/badge.svg)](https://slack.sensu.io/badge) -A sensu plugin to monitor Chrony NTP. There is also a metrics plugin for collecting things like offset, delay etc. - -The plugin generates multiple OK/WARN/CRIT/UNKNOWN check events via the sensu client socket (https://sensuapp.org/docs/latest/clients#client-socket-input) so that you do not miss state changes when monitoring offset, stratum and status. +## Sensu Chrony Checks Plugin -## Installation - -System-wide installation: +- [Overview](#overview) +- [Files](#files) +- [Usage](#usage) +- [Sensu Asset](#sensu-asset) +- [Installation](#installation) + - [Sensu Go](#sensu-go) + - [Asset registration](#asset-registration) + - [Check definition](#check-definition) + - [Sensu Core](#sensu-core) + - [Check definition](#check-definition) +- [Author](#author) - $ gem install sensu-plugins-chrony +### Overiew -Embedded sensu installation: +A sensu plugin to monitor Chrony NTP. There is also a metrics plugin for collecting things like offset, delay etc. - $ /opt/sensu/embedded/bin/gem install sensu-plugins-chrony +The plugin generates multiple OK/WARN/CRIT/UNKNOWN check events via the sensu client socket (https://sensuapp.org/docs/latest/clients#client-socket-input) so that you do not miss state changes when monitoring offset, stratum and status. -## Files +### Files * bin/check-chrony.rb * bin/metrics-chrony.rb -## Usage +### Usage The plugin accepts the following command line options: @@ -44,5 +50,71 @@ Usage: check-chrony.rb (options) Use the --handlers command line option to specify which handlers you want to use for the generated events. + +## Sensu Asset + 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 you include the corresponding Sensu ruby runtime asset in the list of assets needed by the resource. The current ruby-runtime assets can be found [here](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the [Bonsai Asset Index](bonsai.sensu.io). + +## Installation + +`sensuctl asset add jBRNDnl/sensu-plugins-chrony --rename jbrndnl/sensu-plugins-chrony` + +### 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 jBRNDnl/sensu-plugins-chrony --renamd jbrndnl/sensu-plugins-chrony` + +If you're using an earlier version of sensuctl, you can download the asset definition from [this project's Bonsai asset index page](https://bonsai.sensu.io/assets/jBRNDnl/sensu-plugins-chrony). + +#### Check definition + +```yaml +--- +type: CheckConfig +api_version: core/v2 +metadata: + name: check-chrony + namespace: default + labels: null + annotations: null +spec: + check_hooks: null + command: check-chrony.rb + env_vars: null + handlers: [] + interval: 60 + publish: true + round_robin: false + runtime_assets: + - jbrndnl/sensu-plugins-chrony + - sensu/sensu-ruby-runtime + subscriptions: + - linux +``` + +### Sensu Core +System-wide installation: + + $ gem install sensu-plugins-chrony + +Embedded sensu installation: + + $ /opt/sensu/embedded/bin/gem install sensu-plugins-chrony + +#### Check definition +```json +{ + "checks": { + "check-chrony": { + "command": "check-chrony.rb", + "subscribers": ["ALL"], + "interval": 60, + "refresh": 60 + } + } +} +``` + ## Author Matteo Cerutti - diff --git a/bin/check-chrony.rb b/bin/check-chrony.rb index 5fce27c..8e56a55 100755 --- a/bin/check-chrony.rb +++ b/bin/check-chrony.rb @@ -133,7 +133,7 @@ def run send_critical(check_name, msg) elsif stratum >= config[:warn_stratum] msg += ", expected < #{config[:warn_stratum]}" - send_critical(check_name, msg) + send_waning(check_name, msg) else send_ok(check_name, msg) end @@ -150,7 +150,7 @@ def run send_critical(check_name, msg) elsif offset >= config[:warn_offset] || offset < -config[:warn_offset] msg += ", expected > -#{config[:warn_offset]} and < #{config[:warn_offset]}" - send_critical(check_name, msg) + send_waning(check_name, msg) else send_ok(check_name, msg) end diff --git a/lib/sensu-plugins-chrony/version.rb b/lib/sensu-plugins-chrony/version.rb index 25036d3..bc81d0e 100644 --- a/lib/sensu-plugins-chrony/version.rb +++ b/lib/sensu-plugins-chrony/version.rb @@ -2,9 +2,9 @@ module SensuPluginsChrony module Version - MAJOR = 2 - MINOR = 2 - PATCH = 1 + MAJOR = 4 + MINOR = 0 + PATCH = 0 VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.') end