diff --git a/.bonsai.yml b/.bonsai.yml new file mode 100644 index 0000000..cd062dd --- /dev/null +++ b/.bonsai.yml @@ -0,0 +1,56 @@ +--- +description: "#{repo}" +builds: +- platform: "alpine" + arch: "amd64" + asset_filename: "#{repo}_#{version}_alpine_linux_amd64.tar.gz" + sha_filename: "#{repo}_#{version}_sha512-checksums.txt" + filter: + - "entity.system.os == 'linux'" + - "entity.system.arch == 'amd64'" + - "entity.system.platform == 'alpine'" + - "entity.system.platform_version.split('.')[0] == '3'" +- platform: "alpine3.8" + arch: "amd64" + asset_filename: "#{repo}_#{version}_alpine3.8_linux_amd64.tar.gz" + sha_filename: "#{repo}_#{version}_sha512-checksums.txt" + filter: + - "entity.system.os == 'linux'" + - "entity.system.arch == 'amd64'" + - "entity.system.platform == 'alpine'" +- platform: "centos6" + arch: "amd64" + asset_filename: "#{repo}_#{version}_centos6_linux_amd64.tar.gz" + sha_filename: "#{repo}_#{version}_sha512-checksums.txt" + filter: + - "entity.system.os == 'linux'" + - "entity.system.arch == 'amd64'" + - "entity.system.platform_family == 'rhel'" + - "entity.system.platform_version.split('.')[0] == '6'" +- platform: "centos7" + arch: "amd64" + asset_filename: "#{repo}_#{version}_centos7_linux_amd64.tar.gz" + sha_filename: "#{repo}_#{version}_sha512-checksums.txt" + filter: + - "entity.system.os == 'linux'" + - "entity.system.arch == 'amd64'" + - "entity.system.platform_family == 'rhel'" + - "entity.system.platform_version.split('.')[0] == '7'" +- platform: "debian" + arch: "amd64" + asset_filename: "#{repo}_#{version}_debian_linux_amd64.tar.gz" + sha_filename: "#{repo}_#{version}_sha512-checksums.txt" + filter: + - "entity.system.os == 'linux'" + - "entity.system.arch == 'amd64'" + - "entity.system.platform_family == 'debian'" +- platform: "debian9" + arch: "amd64" + asset_filename: "#{repo}_#{version}_debian9_linux_amd64.tar.gz" + sha_filename: "#{repo}_#{version}_sha512-checksums.txt" + filter: + - "entity.system.os == 'linux'" + - "entity.system.arch == 'amd64'" + - "entity.system.platform_family == 'debian'" + - "entity.system.platform_version.split('.')[0] == '9'" + diff --git a/.travis.yml b/.travis.yml index fe1e82d..2a5361e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,6 @@ cache: install: - bundle install rvm: -- 2.1 -- 2.2 - 2.3.0 - 2.4.1 notifications: @@ -18,16 +16,24 @@ script: - bundle exec rake default - gem build sensu-plugins-zookeeper.gemspec - gem install sensu-plugins-zookeeper-*.gem +before_deploy: +- bash -c "[ ! -d bonsai/ ] && git clone https://github.com/sensu/sensu-go-bonsai-asset.git bonsai || echo 'bonsai/ exists, skipping git clone'" + deploy: - provider: rubygems +- provider: rubygems api_key: secure: Mswd19ZpQU0RqJEy2GnyDWTNgd9QCFYuN1q8bqs2U7lHpXARhLI+WDdCCfiyfiMQHxxOyrRLsra12DcREyaOQocQk2rGnlIEfu6GxmRytjyB8MLvowUgWun2D5Rxe4nvXeB5DSReZQMr0K2hm24FmMaUtBSu9N4rnciEn2EgCNM= gem: sensu-plugins-zookeeper on: tags: true all_branches: true - rvm: 2.1 - rvm: 2.2 - rvm: 2.3.0 rvm: 2.4.1 repo: sensu-plugins/sensu-plugins-zookeeper +- provider: script + script: bonsai/ruby-runtime/travis-build-ruby-plugin-assets.sh sensu-plugins-zookeeper + skip_cleanup: true + on: + tags: true + all_branches: true + rvm: 2.4.1 + diff --git a/CHANGELOG.md b/CHANGELOG.md index 625d868..05a32f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,23 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ## [Unreleased] +## [3.0.0] - 2020-03-19 +### Breaking Changes +- Bump `sensu-plugin` dependency 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) +- Make minimum supported ruby version 2.3.0 + +### Added +- Bonsai Asset enablement. Making changes to travis config to enable Bonsai asset building during release deployment + +### Changes +- Update development dependency: bundler ~> 2.1 +- Update development dependency: codeclimate-test-reporter ~> 1.0 +- Update development_dependency: github-markup ~> 3.0 +- Update development_dependency: rake ~> 12.3 + +### Fixed +- Updated how zookeeper information is scraped to use string matching instead of positional matching to accomedate newer zookeeper releases adding additional attributes. + ## [2.0.0] - 2018-01-18 ### Security - updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@thomasriley) @@ -81,7 +98,8 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ### Added - initial release -[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-zookeeper/compare/2.0.0...HEAD +[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-zookeeper/compare/3.0.0...HEAD +[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-zookeeper/compare/2.0.0...3.0.0 [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-zookeeper/compare/1.5.0...2.0.0 [1.5.0]: https://github.com/sensu-plugins/sensu-plugins-zookeeper/compare/1.4.0...1.5.0 [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-zookeeper/compare/1.3.0...1.4.0 diff --git a/README.md b/README.md index 2ee8b44..67121c8 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-zookeeper/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-zookeeper) [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-zookeeper/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-zookeeper) [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-zookeeper.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-zookeeper) +[![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-zookeeper) + +## 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). ## Functionality @@ -22,6 +26,98 @@ * metrics-zookeeper-cluster.rb - Gather metrics from An Exhibitor run Zookeeper cluster ## Usage +``` +$ check-znode.rb --help +Usage: ./bin/check-znode.rb (options) + -v, --check_value REGEX Optionally check the znode value against a regex + -s, --servers zk-address zk address to connect to (required) + -z, --znode ZNODE znode to check (required) +``` + +``` +$ check-zookeeper-file-descriptors.rb --help +Usage: ./bin/check-zookeeper-file-descriptors.rb (options) + -d DESCRIPTORS, Critical threshold for Zookeeper open files descriptors + --file-descriptors + -p, --port PORT Zookeeper port to connect to. + -s, --server HOSTNAME Zookeeper hostname to connect to. + -t, --timeout SECS How long to wait for a reply in seconds. + +``` + +``` +$ check-zookeeper-cluster.rb --help +Usage: ./bin/check-zookeeper-cluster.rb (options) + -c, --count count Zookeeper cluster node count + -e, --exhibitor status end point exhibitor end node for status checks + -l, --latency TICKS Critical threshold for Zookeeper average latency + -t, --timeout SECS How long to wait for a reply in seconds. + -p, --port port Zookeeper nodes' listen port + +``` + +``` +$ check-netty-zookeeper-cluster.rb --help +Usage: ./bin/check-netty-zookeeper-cluster.rb (options) + -c, --count count Zookeeper cluster follower count + -l, --latency TICKS Critical threshold for Zookeeper average latency + -p, --port port Zookeeper nodes' listen port + +``` + +``` +$ metrics-zookeeper.rb --help +Usage: ./bin/metrics-zookeeper.rb (options) + --host HOST ZooKeeper host + --port PORT ZooKeeper port + --scheme SCHEME Metric naming scheme, text to prepend to metrics + +``` + +``` +$ metrics-zookeeper-cluster.rb --help +Usage: ./bin/metrics-zookeeper-cluster.rb (options) + -e, --exhibitor status end point exhibitor end node for status checks + --scheme SCHEME Metric naming scheme, text to prepend to metrics + -p, --port port Zookeeper nodes' listen port + +``` + +``` +$ check-zookeeper-ruok.rb --help +Usage: ./bin/check-zookeeper-ruok.rb (options) + -p, --port PORT Zookeeper port to connect to. + -s, --server HOSTNAME Zookeeper hostname to connect to. + -t, --timeout SECS How long to wait for a reply in seconds. +``` + +``` +$ check-zookeeper-reqs.rb --help +Usage: ./bin/check-zookeeper-reqs.rb (options) + -r, --reqs REQS Critical threshold for Zookeeper outstanding requests + -p, --port PORT Zookeeper port to connect to. + -s, --server HOSTNAME Zookeeper hostname to connect to. + -t, --timeout SECS How long to wait for a reply in seconds. +``` + +``` +$ check-zookeeper-mode.rb --help +Usage check-zookeeper-mode.rb (options) + -m, --mode MODE Space separated expected modes. (required) + -p, --port PORT Zookeeper port to connect to. + -s, --server HOSTNAME Zookeeper hostname to connect to. + -t, --timeout SECS How long to wait for a reply in seconds. +``` + +``` +$ check-zookeeper-latency.rb --help +Usage: ./bin/check-zookeeper-latency.rb (options) + -l, --latency TICKS Critical threshold for Zookeeper average latency + -p, --port PORT Zookeeper port to connect to. + -s, --server HOSTNAME Zookeeper hostname to connect to. + -t, --timeout SECS How long to wait for a reply in seconds. + +``` ## Installation diff --git a/lib/sensu-plugins-zookeeper/version.rb b/lib/sensu-plugins-zookeeper/version.rb index 2bb7942..fa898e2 100644 --- a/lib/sensu-plugins-zookeeper/version.rb +++ b/lib/sensu-plugins-zookeeper/version.rb @@ -1,6 +1,6 @@ module SensuPluginsZookeeper module Version - MAJOR = 2 + MAJOR = 3 MINOR = 0 PATCH = 0 diff --git a/sensu-plugins-zookeeper.gemspec b/sensu-plugins-zookeeper.gemspec index 8ceb12b..5959ad8 100644 --- a/sensu-plugins-zookeeper.gemspec +++ b/sensu-plugins-zookeeper.gemspec @@ -21,16 +21,16 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength s.platform = Gem::Platform::RUBY s.post_install_message = 'You can use the embedded Ruby by setting EMBEDDED_RUBY=true in /etc/default/sensu' s.require_paths = ['lib'] - s.required_ruby_version = '>= 2.1.0' + s.required_ruby_version = '>= 2.3.0' s.summary = 'Sensu plugins for zookeeper' s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.version = SensuPluginsZookeeper::Version::VER_STRING - s.add_runtime_dependency 'sensu-plugin', '~> 1.2' + s.add_runtime_dependency 'sensu-plugin', '~> 4.0' s.add_runtime_dependency 'zookeeper', '1.4.11' - s.add_development_dependency 'bundler', '~> 1.7' + s.add_development_dependency 'bundler', '~> 2.1' s.add_development_dependency 'codeclimate-test-reporter', '~> 1.0' s.add_development_dependency 'github-markup', '~> 3.0' s.add_development_dependency 'pry', '~> 0.10'