sensu-plugins-raid-checks 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2d439985a3f3eb77e2c6cfc0bb4d3e97bb1c95af
4
- data.tar.gz: 432f11999e85966ade57f89f6ac46af10832bc27
2
+ SHA256:
3
+ metadata.gz: 5a807491188351610c1d92f61ffdf6453c34c51de3bd1d73f68d15a1dcb00a82
4
+ data.tar.gz: 42e2aa80eb09c459902a41d6c8359666b5a43e37436b44b9759e41a95eec73e2
5
5
  SHA512:
6
- metadata.gz: 6c9f6d9f7473fad7d92a898a975a51e4ecd29461493806d66a5dea4ec1747a0452ef566f9d63a54cd7fbd98d5776a145be5e6c7bb688775ae3aa9a12922afe64
7
- data.tar.gz: 61db581a39d3073ba7a54266576637824c386751123e64c35e75db28858f627bb6e2e2059d11ab23b33a3d4a22573d8e7e7711ebb638778c73eb1fe635c909b5
6
+ metadata.gz: e63a5f13dcac901435fb91f7a64e72d07caf8eed21f1813c6d579f322050b39f0747eec11e8e64227299306260738c5e7b36fd77fcd5d1a37629f266f36d96f0
7
+ data.tar.gz: c9d7eed41e4372d708693bf39f6954ba7374642770d9ae973b184c5ad5f103adfac9049f1bcbdd28360753de01b495148300cb83b6dcd6171010828809e4f682
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.0.1] - 2017-01-31
10
+ ### Security
11
+ - updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)
12
+
13
+ ### Changed
14
+ - appeased the cops (@majormoses)
15
+
9
16
  ## [2.0.0] - 2017-12-28
10
17
  ### Breaking Change
11
18
  - `check-raid.rb`: added option `--log` with a default of `false` to prevent it default creating a log which is frequently being written to and filling up the disk. This does the *opposite* of what the vendor defaults are but due to the nature of those running it through a monitoring solution like sensu the defaults do not make sense in this use case. If you are wanting those logs you can change this to `true` to keep existing behavior. (@dhpowrhost) (@smbambling)
@@ -56,6 +63,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
56
63
  - initial release
57
64
 
58
65
  [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/2.0.0...HEAD
66
+ [2.0.1]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/2.0.0...2.0.1
59
67
  [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/1.0.0...2.0.0
60
68
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/0.1.0...1.0.0
61
69
  [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-raid-checks/compare/0.0.4...0.1.0
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-raid
4
6
  #
@@ -82,7 +84,7 @@ class Check3wareStatus < Sensu::Plugin::Check::CLI
82
84
  data.lines.each do |line|
83
85
  unless line.empty?
84
86
  controller = line.split[0]
85
- @controllers << controller if /^c[0-9]+$/ =~ controller
87
+ @controllers << controller if controller.match?(/^c[0-9]+$/)
86
88
  end
87
89
  end
88
90
  end
@@ -97,7 +99,7 @@ class Check3wareStatus < Sensu::Plugin::Check::CLI
97
99
  data.lines.each do |line|
98
100
  unless line.empty?
99
101
  splitted = line.split
100
- if /^[p][0-9]+$/ =~ splitted[0]
102
+ if splitted.first.match?(/^[p][0-9]+$/)
101
103
  # '-' means the drive doesn't belong to any array
102
104
  # If is NOT PRESENT too, it just means this is an empty port
103
105
  status = splitted[1]
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-raid
4
6
  #
@@ -56,7 +58,7 @@ class CheckMegaRAID < Sensu::Plugin::Check::CLI
56
58
  (0..$CHILD_STATUS.exitstatus - 1).each do |i|
57
59
  # and check them in turn
58
60
  stdout = `#{config[:megaraidcmd]} -LDInfo -L#{i} -a#{config[:controller]} `
59
- unless Regexp.new('State\s*:\s*Optimal').match(stdout)
61
+ unless Regexp.new('State\s*:\s*Optimal').match?(stdout)
60
62
  error = sprintf '%svirtual drive %d: %s ', error, i, stdout[/State\s*:\s*.*/].split(':')[1] # rubocop:disable Style/FormatString
61
63
  have_error = true
62
64
  end
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-raid
4
6
  #
data/bin/check-raid.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-raid
4
6
  #
@@ -38,97 +40,92 @@ class CheckRaid < Sensu::Plugin::Check::CLI
38
40
  default: false
39
41
  # Check software raid
40
42
  #
41
- def check_software
42
- if File.exist?('/proc/mdstat')
43
- contents = File.read('/proc/mdstat')
44
- mg = contents.lines.grep(/active|blocks/)
45
- unless mg.empty?
46
- sg = mg.to_s.lines.grep(/\]\(F\)|[\[U]_/)
47
- unless sg.empty? # rubocop:disable UnlessElse
48
- warning 'Software RAID warning'
49
- else
50
- ok 'Software RAID OK'
51
- end
52
- end
43
+ def check_software_raid
44
+ return unless File.exist?('/proc/mdstat')
45
+ contents = File.read('/proc/mdstat')
46
+ mg = contents.lines.grep(/active|blocks/)
47
+ return unless mg.empty?
48
+ sg = mg.to_s.lines.grep(/\]\(F\)|[\[U]_/)
49
+ if sg.empty?
50
+ ok 'Software RAID OK'
51
+ else
52
+ warning 'Software RAID warning'
53
53
  end
54
54
  end
55
55
 
56
56
  # Check HP raid
57
57
  #
58
58
  def check_hp
59
- if File.exist?('/usr/bin/cciss_vol_status')
60
- contents = `/usr/bin/cciss_vol_status /dev/sg0`
61
- c = contents.lines.grep(/status\: OK\./)
62
- # #YELLOW
63
- unless c.empty? # rubocop:disable UnlessElse
64
- ok 'HP RAID OK'
65
- else
66
- warning 'HP RAID warning'
67
- end
59
+ return unless File.exist?('/usr/bin/cciss_vol_status')
60
+ contents = `/usr/bin/cciss_vol_status /dev/sg0`
61
+ c = contents.lines.grep(/status\: OK\./)
62
+ # #YELLOW
63
+ if c.empty?
64
+ warning 'HP RAID warning'
65
+ else
66
+ ok 'HP RAID OK'
68
67
  end
69
68
  end
70
69
 
71
70
  # Check Adaptec raid controllers
72
71
  #
73
72
  def check_adaptec
74
- if File.exist?('/usr/StorMan/arcconf')
75
- contents = `/usr/StorMan/arcconf GETCONFIG 1 AL`
76
-
77
- mg = contents.lines.grep(/Controller Status/)
78
- # #YELLOW
79
- unless mg.empty? # rubocop:disable UnlessElse
80
- sg = mg.to_s.lines.grep(/Optimal/)
81
- warning 'Adaptec Physical RAID Controller Failure' if sg.empty?
82
- else
83
- warning 'Adaptec Physical RAID Controller Status Read Failure'
84
- end
73
+ return unless File.exist?('/usr/StorMan/arcconf')
74
+ contents = `/usr/StorMan/arcconf GETCONFIG 1 AL`
85
75
 
86
- mg = contents.lines.grep(/Status of logical device/)
87
- # #YELLOW
88
- unless mg.empty? # rubocop:disable UnlessElse
89
- sg = mg.to_s.lines.grep(/Optimal/)
90
- warning 'Adaptec Logical RAID Controller Failure' if sg.empty?
91
- else
92
- warning 'Adaptec Logical RAID Controller Status Read Failure'
93
- end
76
+ mg = contents.lines.grep(/Controller Status/)
77
+ # #YELLOW
78
+ if mg.empty?
79
+ warning 'Adaptec Physical RAID Controller Status Read Failure'
80
+ else
81
+ sg = mg.to_s.lines.grep(/Optimal/)
82
+ warning 'Adaptec Physical RAID Controller Failure' if sg.empty?
83
+ end
94
84
 
95
- mg = contents.lines.grep(/S\.M\.A\.R\.T\. /)
96
- # #YELLOW
97
- unless mg.empty? # rubocop:disable UnlessElse
98
- sg = mg.to_s.lines.grep(/No/)
99
- warning 'Adaptec S.M.A.R.T. Disk Failed' if sg.empty?
100
- else
101
- warning 'Adaptec S.M.A.R.T. Status Read Failure'
102
- end
85
+ mg = contents.lines.grep(/Status of logical device/)
86
+ # #YELLOW
87
+ if mg.empty?
88
+ warning 'Adaptec Logical RAID Controller Status Read Failure'
89
+ else
90
+ sg = mg.to_s.lines.grep(/Optimal/)
91
+ warning 'Adaptec Logical RAID Controller Failure' if sg.empty?
92
+ end
103
93
 
104
- ok 'Adaptec RAID OK'
94
+ mg = contents.lines.grep(/S\.M\.A\.R\.T\. /)
95
+ # #YELLOW
96
+ if mg.empty?
97
+ warning 'Adaptec S.M.A.R.T. Status Read Failure'
98
+ else
99
+ sg = mg.to_s.lines.grep(/No/)
100
+ warning 'Adaptec S.M.A.R.T. Disk Failed' if sg.empty?
105
101
  end
102
+
103
+ ok 'Adaptec RAID OK'
106
104
  end
107
105
 
108
106
  # Check Megaraid
109
107
  #
110
108
  def check_mega_raid
111
- if File.exist?('/usr/sbin/megacli')
112
- contents = if config[:log]
113
- `/usr/sbin/megacli -AdpAllInfo -aALL`
114
- else
115
- `/usr/sbin/megacli -AdpAllInfo -aALL -NoLog`
116
- end
117
- failed = contents.lines.grep(/(Critical|Failed) Disks\s+\: 0/)
118
- degraded = contents.lines.grep(/Degraded\s+\: 0/)
119
- # #YELLOW
120
- unless failed.empty? || degraded.empty? # rubocop:disable UnlessElse
121
- ok 'MegaRaid RAID OK'
122
- else
123
- warning 'MegaRaid RAID warning'
124
- end
109
+ return unless File.exist?('/usr/sbin/megacli')
110
+ contents = if config[:log]
111
+ `/usr/sbin/megacli -AdpAllInfo -aALL`
112
+ else
113
+ `/usr/sbin/megacli -AdpAllInfo -aALL -NoLog`
114
+ end
115
+ failed = contents.lines.grep(/(Critical|Failed) Disks\s+\: 0/)
116
+ degraded = contents.lines.grep(/Degraded\s+\: 0/)
117
+ # #YELLOW
118
+ if failed.empty? || degraded.empty?
119
+ warning 'MegaRaid RAID warning'
120
+ else
121
+ ok 'MegaRaid RAID OK'
125
122
  end
126
123
  end
127
124
 
128
125
  # Main function
129
126
  #
130
127
  def run
131
- check_software
128
+ check_software_raid
132
129
  unless `lspci`.lines.grep(/RAID/).empty?
133
130
  check_hp
134
131
  check_adaptec
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-smart-array-status
4
6
  #
@@ -85,7 +87,7 @@ class CheckSmartArrayStatus < Sensu::Plugin::Check::CLI
85
87
  data.lines.each do |line|
86
88
  unless line.empty?
87
89
  splitted = line.split
88
- if /^physicaldrive$/ =~ splitted[0]
90
+ if splitted.first.match?(/^physicaldrive$/)
89
91
  status = splitted[-1]
90
92
  disk = 'ctrl ' + controller + ' ' + line.strip
91
93
  if status == 'OK'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sensu-plugins-raid-checks/version'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SensuPluginsRaidChecks
2
4
  module Version
3
5
  MAJOR = 2
4
6
  MINOR = 0
5
- PATCH = 0
7
+ PATCH = 1
6
8
 
7
9
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-raid-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-28 00:00:00.000000000 Z
11
+ date: 2018-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: english
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.40.0
145
+ version: 0.51.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.40.0
152
+ version: 0.51.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: yard
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -170,11 +170,11 @@ description: |-
170
170
  controller/array health
171
171
  email: "<sensu-users@googlegroups.com>"
172
172
  executables:
173
- - check-smart-array-status.rb
174
- - check-mpt2sas-status.rb
175
- - check-megaraid-sas-status.rb
176
173
  - check-3ware-status.rb
174
+ - check-megaraid-sas-status.rb
175
+ - check-mpt2sas-status.rb
177
176
  - check-raid.rb
177
+ - check-smart-array-status.rb
178
178
  extensions: []
179
179
  extra_rdoc_files: []
180
180
  files:
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  version: '0'
215
215
  requirements: []
216
216
  rubyforge_project:
217
- rubygems_version: 2.6.11
217
+ rubygems_version: 2.7.4
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: Sensu plugins for working with raid evices