sensu-plugins-disk-checks 1.1.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70cfbdd21bd520136259552003e3a60d363246f3
4
- data.tar.gz: e922cddef3c7b7dee281556e26bb65ff22d91598
3
+ metadata.gz: e9e27d97d82cd497c6fe1fc5b96945f2b6c81aa5
4
+ data.tar.gz: 207be7ea90fcd64d563cc74779e396b4c2a1c64a
5
5
  SHA512:
6
- metadata.gz: 7af23943cd7939e1fd36c10939ecc814a4418c79fb15301d2d35f91e7b8ee31655e2c2631eddc33b240f589283927e00258be16635b75b9d3170fb52d1ffdfc4
7
- data.tar.gz: 2ac99b50435fe73d71b85811c8784462bd3cbe9f5542f45c82fc48df58b36a8c67128590f24d220367bc378f5134a2e4635b6cd6fa8015d5848a86f7d700eed5
6
+ metadata.gz: 762876c2a66994b5de9d54455971acee350c91bcf91aba7fd00bee398c112113c90bd0d265799f8cec34fbf40a3ebb9ccc0583b1af2093aab4eedcbc1f86270a
7
+ data.tar.gz: c9a35497d489ad4cc1b5c133b9f37a5a68f5398a142bbdcb1fe2bcb0cffaedb39eab21fbf120c9138b892261f1b14edadcb99e75db584cf4eb62772909a4963c
@@ -3,9 +3,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## Unreleased
6
+ ## [Unreleased]
7
7
 
8
- [1.1.3] - 2016-01-15
8
+ ## [2.0.0]
9
+ ### Changed
10
+ - Updated Rubocop to 0.40, applied auto-correct.
11
+ - metrics-disk.rb: Now using sysfs instead of lsblk for translating device mapper numbers to names
12
+ - check-disk-usage.rb: values =< 1024 will not be modified for display in output
13
+
14
+ ### Removed
15
+ - Remove Ruby 1.9.3 support; add Ruby 2.3.0 support
16
+
17
+ ## [1.1.3] - 2016-01-15
9
18
  ### Added
10
19
  - Add --json option to check-smart-status.rb
11
20
 
@@ -93,6 +102,20 @@ https://mathias-kettner.de/checkmk_filesystems.html
93
102
  ### Fixed
94
103
  - deployment issue
95
104
 
96
- ## [0.0.1] - 2015-04-21
105
+ ## 0.0.1 - 2015-04-21
97
106
  ### Added
98
107
  - initial release
108
+
109
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/2.0.0...HEAD
110
+ [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/1.1.3...2.0.0
111
+ [1.1.3]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/1.1.2...1.1.3
112
+ [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/1.1.1...1.1.2
113
+ [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/1.1.1...1.1.1
114
+ [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/1.0.3...1.1.0
115
+ [1.0.3]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/1.0.2...1.0.3
116
+ [1.0.2]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/1.0.1...1.0.2
117
+ [1.0.1]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/1.0.0...1.0.1
118
+ [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/0.0.4...1.0.0
119
+ [0.0.4]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/0.0.3...0.0.4
120
+ [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/0.0.2...0.0.3
121
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-disk-checks.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-disk-checks)
8
- [![Codeship Status for sensu-plugins/sensu-plugins-disk-checks](https://codeship.com/projects/a78630e0-cc5b-0132-01ab-7a3494c6b360/status?branch=master)](https://codeship.com/projects/76007)
8
+
9
9
  ## Functionality
10
10
 
11
11
  **check-disk-usage**
@@ -179,7 +179,7 @@ class CheckDisk < Sensu::Plugin::Check::CLI
179
179
 
180
180
  def to_human(s)
181
181
  unit = [[1_099_511_627_776, 'TiB'], [1_073_741_824, 'GiB'], [1_048_576, 'MiB'], [1024, 'KiB'], [0, 'B']].detect { |u| s >= u[0] }
182
- "#{s > 0 ? s / unit[0] : s} #{unit[1]}"
182
+ "#{s >= 1024 ? s / unit[0] : s} #{unit[1]}"
183
183
  end
184
184
 
185
185
  # Determine the percent inode usage
@@ -63,7 +63,7 @@ class CheckFstabMounts < Sensu::Plugin::Check::CLI
63
63
  if fields[2] != 'swap'
64
64
  @missing_mounts << fields[1] if @mtab.select { |m| m.split(/\s+/)[1] == fields[1] }.empty?
65
65
  else
66
- @missing_mounts << fields[1] if @swap_mounts.select { |m| m.split(/\s+/)[0] == Pathname.new(fields[0]).realpath.to_s }.empty?
66
+ @missing_mounts << fields[1] if @swap_mounts.select { |m| m.split(/\s+/)[0] == Pathname.new(fields[0]).realpath.to_s }.empty? # rubocop:disable Style/IfInsideElse
67
67
  end
68
68
  end
69
69
  end
@@ -132,7 +132,7 @@ class SmartCheckStatus < Sensu::Plugin::Check::CLI
132
132
 
133
133
  # Set default threshold
134
134
  default_threshold = config[:defaults].split(',')
135
- fail 'Invalid default threshold parameter count' unless default_threshold.size == 4
135
+ raise 'Invalid default threshold parameter count' unless default_threshold.size == 4
136
136
  @smart_attributes.each do |att|
137
137
  att[:crit_min] = default_threshold[0].to_i if att[:crit_min].nil?
138
138
  att[:warn_min] = default_threshold[1].to_i if att[:warn_min].nil?
@@ -144,7 +144,7 @@ class SmartCheckStatus < Sensu::Plugin::Check::CLI
144
144
  unless config[:threshold].nil?
145
145
  thresholds = config[:threshold].split(',')
146
146
  # Check threshold parameter length
147
- fail 'Invalid threshold parameter count' unless thresholds.size % 5 == 0
147
+ raise 'Invalid threshold parameter count' unless thresholds.size % 5 == 0
148
148
 
149
149
  (0..(thresholds.size / 5 - 1)).each do |i|
150
150
  att_id = @smart_attributes.index { |att| att[:id] == thresholds[i + 0].to_i }
@@ -203,7 +203,7 @@ class SmartCheckStatus < Sensu::Plugin::Check::CLI
203
203
  warnings << "#{dev} warning #{fields[0]} #{smart_att[:name]}: #{att_value}"
204
204
  puts "#{fields[0]} #{smart_att[:name]}: #{att_value} (warning)" if @smart_debug
205
205
  else
206
- puts "#{fields[0]} #{smart_att[:name]}: #{att_value} (ok)" if @smart_debug
206
+ puts "#{fields[0]} #{smart_att[:name]}: #{att_value} (ok)" if @smart_debug # rubocop:disable Style/IfInsideElse
207
207
  end
208
208
  end
209
209
  end
@@ -53,7 +53,7 @@ class Disk
53
53
  check_health! if smart_capable?
54
54
  end
55
55
  attr_reader :capability_output, :health_output, :smart_healthy
56
- alias_method :healthy?, :smart_healthy
56
+ alias healthy? smart_healthy
57
57
 
58
58
  # Is the device SMART capable and enabled
59
59
  #
@@ -39,7 +39,7 @@ class DiskCapacity < Sensu::Plugin::Metric::CLI::Graphite
39
39
  option :scheme,
40
40
  description: 'Metric naming scheme, text to prepend to .$parent.$child',
41
41
  long: '--scheme SCHEME',
42
- default: "#{Socket.gethostname}"
42
+ default: Socket.gethostname.to_s
43
43
 
44
44
  # Unused ?
45
45
  #
@@ -63,13 +63,13 @@ class DiskCapacity < Sensu::Plugin::Metric::CLI::Graphite
63
63
  fs, _type, _blocks, used, avail, capacity, _mnt = line.split
64
64
 
65
65
  timestamp = Time.now.to_i
66
- if fs.match('/dev')
66
+ if fs =~ '/dev'
67
67
  fs = fs.gsub('/dev/', '')
68
68
  metrics = {
69
69
  disk: {
70
70
  "#{fs}.used" => used,
71
71
  "#{fs}.avail" => avail,
72
- "#{fs}.capacity" => capacity.gsub('%', '')
72
+ "#{fs}.capacity" => capacity.delete('%')
73
73
  }
74
74
  }
75
75
  metrics.each do |parent, children|
@@ -89,13 +89,13 @@ class DiskCapacity < Sensu::Plugin::Metric::CLI::Graphite
89
89
  fs, _inodes, used, avail, capacity, _mnt = line.split
90
90
 
91
91
  timestamp = Time.now.to_i
92
- if fs.match('/dev')
92
+ if fs =~ '/dev'
93
93
  fs = fs.gsub('/dev/', '')
94
94
  metrics = {
95
95
  disk: {
96
96
  "#{fs}.iused" => used,
97
97
  "#{fs}.iavail" => avail,
98
- "#{fs}.icapacity" => capacity.gsub('%', '')
98
+ "#{fs}.icapacity" => capacity.delete('%')
99
99
  }
100
100
  }
101
101
  metrics.each do |parent, children|
@@ -99,21 +99,21 @@ class DiskUsageMetrics < Sensu::Plugin::Metric::CLI::Graphite
99
99
  `df -PB#{config[:block_size]} #{config[:local] ? '-l' : ''}`.split("\n").drop(1).each do |line|
100
100
  _, _, used, avail, used_p, mnt = line.split
101
101
 
102
- unless %r{/sys[/|$]|/dev[/|$]|/run[/|$]}.match(mnt)
102
+ unless %r{/sys[/|$]|/dev[/|$]|/run[/|$]} =~ mnt
103
103
  next if config[:ignore_mnt] && config[:ignore_mnt].find { |x| mnt.match(x) }
104
104
  next if config[:include_mnt] && !config[:include_mnt].find { |x| mnt.match(x) }
105
- if config[:flatten]
106
- mnt = mnt.eql?('/') ? 'root' : mnt.gsub(/^\//, '')
107
- else
108
- # If mnt is only / replace that with root if its /tmp/foo
109
- # replace first occurance of / with root.
110
- mnt = mnt.length == 1 ? 'root' : mnt.gsub(/^\//, 'root.')
111
- end
105
+ mnt = if config[:flatten]
106
+ mnt.eql?('/') ? 'root' : mnt.gsub(/^\//, '')
107
+ else
108
+ # If mnt is only / replace that with root if its /tmp/foo
109
+ # replace first occurance of / with root.
110
+ mnt.length == 1 ? 'root' : mnt.gsub(/^\//, 'root.')
111
+ end
112
112
  # Fix subsequent slashes
113
113
  mnt = mnt.gsub '/', delim
114
114
  output [config[:scheme], mnt, 'used'].join('.'), used.gsub(config[:block_size], '')
115
115
  output [config[:scheme], mnt, 'avail'].join('.'), avail.gsub(config[:block_size], '')
116
- output [config[:scheme], mnt, 'used_percentage'].join('.'), used_p.gsub('%', '')
116
+ output [config[:scheme], mnt, 'used_percentage'].join('.'), used_p.delete('%')
117
117
  end
118
118
  end
119
119
  ok
@@ -72,7 +72,7 @@ class DiskGraphite < Sensu::Plugin::Metric::CLI::Graphite
72
72
  stats = line.strip.split(/\s+/)
73
73
  _major, _minor, dev = stats.shift(3)
74
74
  if config[:convert]
75
- dev = `lsblk -P -o NAME /dev/"#{dev}"| cut -d\\" -f2`.lines.first.chomp! if dev =~ /^dm-.*$/
75
+ dev = File.read('/sys/block/' + dev + '/dm/name').chomp! if dev =~ /^dm-.*$/
76
76
  end
77
77
  next if stats == ['0'].cycle.take(stats.size)
78
78
 
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsDiskChecks
2
2
  module Version
3
- MAJOR = 1
4
- MINOR = 1
5
- PATCH = 3
3
+ MAJOR = 2
4
+ MINOR = 0
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,51 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-disk-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
- am9uZXMxGDAWBgoJkiaJk/Is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sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2016-01-15 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-06-14 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: sensu-plugin
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - '='
17
+ - - "~>"
40
18
  - !ruby/object:Gem::Version
41
- version: 1.2.0
19
+ version: '1.2'
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - '='
24
+ - - "~>"
47
25
  - !ruby/object:Gem::Version
48
- version: 1.2.0
26
+ version: '1.2'
49
27
  - !ruby/object:Gem::Dependency
50
28
  name: sys-filesystem
51
29
  requirement: !ruby/object:Gem::Requirement
@@ -162,16 +140,16 @@ dependencies:
162
140
  name: rubocop
163
141
  requirement: !ruby/object:Gem::Requirement
164
142
  requirements:
165
- - - '='
143
+ - - "~>"
166
144
  - !ruby/object:Gem::Version
167
- version: 0.32.1
145
+ version: 0.40.0
168
146
  type: :development
169
147
  prerelease: false
170
148
  version_requirements: !ruby/object:Gem::Requirement
171
149
  requirements:
172
- - - '='
150
+ - - "~>"
173
151
  - !ruby/object:Gem::Version
174
- version: 0.32.1
152
+ version: 0.40.0
175
153
  - !ruby/object:Gem::Dependency
176
154
  name: yard
177
155
  requirement: !ruby/object:Gem::Requirement
@@ -192,13 +170,13 @@ description: |-
192
170
  health, usage, and various metrics.
193
171
  email: "<sensu-users@googlegroups.com>"
194
172
  executables:
195
- - metrics-disk.rb
196
- - metrics-disk-usage.rb
197
- - metrics-disk-capacity.rb
198
- - check-smart.rb
199
- - check-smart-status.rb
200
- - check-fstab-mounts.rb
201
173
  - check-disk-usage.rb
174
+ - check-fstab-mounts.rb
175
+ - check-smart-status.rb
176
+ - check-smart.rb
177
+ - metrics-disk-capacity.rb
178
+ - metrics-disk-usage.rb
179
+ - metrics-disk.rb
202
180
  extensions: []
203
181
  extra_rdoc_files: []
204
182
  files:
@@ -232,7 +210,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
210
  requirements:
233
211
  - - ">="
234
212
  - !ruby/object:Gem::Version
235
- version: 1.9.3
213
+ version: 2.0.0
236
214
  required_rubygems_version: !ruby/object:Gem::Requirement
237
215
  requirements:
238
216
  - - ">="
@@ -240,8 +218,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
218
  version: '0'
241
219
  requirements: []
242
220
  rubyforge_project:
243
- rubygems_version: 2.4.8
221
+ rubygems_version: 2.5.1
244
222
  signing_key:
245
223
  specification_version: 4
246
224
  summary: Sensu plugins for disk checks
247
225
  test_files: []
226
+ has_rdoc:
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file