diff --git a/.travis.yml b/.travis.yml index 1286acc..6ced345 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: @@ -26,8 +24,5 @@ deploy: 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-raid-checks diff --git a/CHANGELOG.md b/CHANGELOG.md index 5973c0c..2ae86b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ## [Unreleased] +## [3.0.0] - 2020-04-14 +### Breaking Changes +- `english` 0.6.3 has been yanked - https://rubygems.org/gems/english/versions/0.6.3. +- Bump minimum required ruby to 2.3 +- Update bundler development dep to `2.1` to match travis environment +- Update sensu-plugin dep 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) +- Update rake dep +- Update robocup dep +- Update yard dep + ## [2.0.3] - 2019-02-17 ### Fixed - `check-megaraid-sas-status.rb`: Fixed logic error in which it was assumed that all virtual drives were in sequential order. Also fixed pattern matching when parsing individual drive status. (@SeanSith) @@ -70,7 +80,8 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ### Added - initial release -[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/2.0.3...HEAD +[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/3.0.0...HEAD +[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/2.0.3...3.0.0 [2.0.3]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/2.0.2...2.0.3 [2.0.2]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/2.0.1...2.0.2 [2.0.1]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/2.0.0...2.0.1 diff --git a/Rakefile b/Rakefile index d457ce4..02f43d3 100644 --- a/Rakefile +++ b/Rakefile @@ -29,7 +29,7 @@ desc 'Test for binstubs' task :check_binstubs do bin_list = Gem::Specification.load('sensu-plugins-raid-checks.gemspec').executables bin_list.each do |b| - `which #{ b }` + `which #{b}` unless $CHILD_STATUS.success? puts "#{b} was not a binstub" exit diff --git a/bin/check-3ware-status.rb b/bin/check-3ware-status.rb index ad1cf6d..b024172 100755 --- a/bin/check-3ware-status.rb +++ b/bin/check-3ware-status.rb @@ -107,7 +107,7 @@ def parse_disks!(data, controller) unit = splitted[2] if unit != '-' && unit != 'NOT-PRESENT' # #YELLOW - if status == 'OK' # rubocop:disable BlockNesting + if status == 'OK' # rubocop:disable Metrics/BlockNesting @good_disks << controller + unit + name + ': ' + status else @bad_disks << controller + unit + name + ': ' + status diff --git a/bin/check-megaraid-sas-status.rb b/bin/check-megaraid-sas-status.rb index 9c6cdf5..a5238f4 100755 --- a/bin/check-megaraid-sas-status.rb +++ b/bin/check-megaraid-sas-status.rb @@ -68,7 +68,7 @@ def run # this reduces memory consumption as we don't care about the output in this conditional just whether or not it matches. # The `.match?()` function was introduced in 2.4 unless Regexp.new(/State\s+:\s+Optimal/).match(stdout) - error = sprintf '%svirtual drive %d: %s ', error, i, stdout[/State\s*:\s*.*/].split(':')[1] # rubocop:disable Style/FormatString + error = sprintf '%svirtual drive %d: %s ', error, i, stdout[/State\s*:\s*.*/].split(':')[1] # rubocop:disable Style/FormatString, Style/FormatStringToken have_error = true end end diff --git a/bin/check-mpt2sas-status.rb b/bin/check-mpt2sas-status.rb index 32073da..42920b7 100755 --- a/bin/check-mpt2sas-status.rb +++ b/bin/check-mpt2sas-status.rb @@ -67,7 +67,7 @@ def run parts = line.match(volume_state) unless parts.nil? unless parts['VolState'] == 'Optimal' - error = format('%s%s ', error, parts['VolState']) + error = format('%s%s ', error, parts['VolState']) # rubocop:disable Style/FormatStringToken have_error = true end end diff --git a/bin/check-raid.rb b/bin/check-raid.rb index 199a66c..eff3649 100755 --- a/bin/check-raid.rb +++ b/bin/check-raid.rb @@ -42,9 +42,11 @@ class CheckRaid < Sensu::Plugin::Check::CLI # def check_software_raid return unless File.exist?('/proc/mdstat') + contents = File.read('/proc/mdstat') mg = contents.lines.grep(/active|blocks/) return if mg.empty? + sg = mg.to_s.lines.grep(/\]\(F\)|[\[U]_/) if sg.empty? ok 'Software RAID OK' @@ -57,6 +59,7 @@ def check_software_raid # def check_hp return unless File.exist?('/usr/bin/cciss_vol_status') + contents = `/usr/bin/cciss_vol_status /dev/sg0` c = contents.lines.grep(/status\: OK\./) # #YELLOW @@ -71,6 +74,7 @@ def check_hp # def check_adaptec return unless File.exist?('/usr/StorMan/arcconf') + contents = `/usr/StorMan/arcconf GETCONFIG 1 AL` mg = contents.lines.grep(/Controller Status/) @@ -107,6 +111,7 @@ def check_adaptec # def check_mega_raid return unless File.exist?('/usr/sbin/megacli') + contents = if config[:log] `/usr/sbin/megacli -AdpAllInfo -aALL` else diff --git a/lib/sensu-plugins-raid-checks/version.rb b/lib/sensu-plugins-raid-checks/version.rb index fb4060a..7167c96 100644 --- a/lib/sensu-plugins-raid-checks/version.rb +++ b/lib/sensu-plugins-raid-checks/version.rb @@ -2,9 +2,9 @@ module SensuPluginsRaidChecks module Version - MAJOR = 2 + MAJOR = 3 MINOR = 0 - PATCH = 3 + PATCH = 0 VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.') end diff --git a/sensu-plugins-raid-checks.gemspec b/sensu-plugins-raid-checks.gemspec index b36e56a..babf95e 100644 --- a/sensu-plugins-raid-checks.gemspec +++ b/sensu-plugins-raid-checks.gemspec @@ -1,12 +1,12 @@ # frozen_string_literal: true -lib = File.expand_path('../lib', __FILE__) +lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'date' require_relative 'lib/sensu-plugins-raid-checks' -Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength +Gem::Specification.new do |s| s.authors = ['Sensu-Plugins and contributors'] s.date = Date.today.to_s @@ -18,31 +18,31 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength s.files = Dir.glob('{bin,lib}/**/*') + %w[LICENSE README.md CHANGELOG.md] s.homepage = 'https://github.com/sensu-plugins/sensu-plugins-raid-checks' s.license = 'MIT' - s.metadata = { 'maintainer' => 'sensu-plugin', + s.metadata = { 'maintainer' => 'sensu-plugin', 'development_status' => 'active', - 'production_status' => 'unstable - testing recommended', - 'release_draft' => 'false', + 'production_status' => 'unstable - testing recommended', + 'release_draft' => 'false', 'release_prerelease' => 'false' } s.name = 'sensu-plugins-raid-checks' 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 working with raid evices' s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.version = SensuPluginsRaidChecks::Version::VER_STRING - s.add_runtime_dependency 'english', '0.6.3' - s.add_runtime_dependency 'sensu-plugin', '~> 1.2' + s.add_runtime_dependency 'english', '0.7.0' + s.add_runtime_dependency 'sensu-plugin', '~> 4.0' - 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' - s.add_development_dependency 'rake', '~> 12.3' + s.add_development_dependency 'rake', '~> 13.0' s.add_development_dependency 'redcarpet', '~> 3.2' - s.add_development_dependency 'rspec', '~> 3.1' - s.add_development_dependency 'rubocop', '~> 0.51.0' - s.add_development_dependency 'yard', '~> 0.8' + s.add_development_dependency 'rspec', '~> 3.7' + s.add_development_dependency 'rubocop', '~> 0.80.1' + s.add_development_dependency 'yard', '~> 0.9.20' end