sensu-plugins-hardware 1.0.0 → 1.1.0

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
2
  SHA1:
3
- metadata.gz: b3cdbbc88bdca62bd04855924c886da0cadd9b7b
4
- data.tar.gz: 3591ce2553deadae24a155590e4b4a5d51e43985
3
+ metadata.gz: ec6fc7437d99045ad6597bccfb65c1cd7741a326
4
+ data.tar.gz: 53c98ddd65cc5a7c1e1240bca0680135247b027c
5
5
  SHA512:
6
- metadata.gz: 158bfee61aaa74682572b3fdc28a30934ce2d276b875a7b27bf22b9467c88c15f62b7fdb5646c183ede40d99e5a1e4fbc6c1502fe48c53f15e7207b829b3a532
7
- data.tar.gz: 65de888498795aec723842650c57815a7a19cc58e234be5efeb67376b025842279fb66e156ba6351f3ca911b3e955d1efb688ccc313239c37a46be631d2cd174
6
+ metadata.gz: 4a92fb5d6832dbbc241bf75c3ead01cdf30b34e3f40ee5defedc6c6506a12846cb1ed6d6044b5cf2342c655c3a6c917e9b7ae627a1e6ded06e7c39a5dba3496b
7
+ data.tar.gz: 09766fe5a187addb0e4e30c649ff833eddd34f90919d005a9b7eddd120345c807c1ae1ce86799e0efc41ef399e2086acbed034fbc80e3327459eb65cd0d00c11
@@ -1,10 +1,15 @@
1
- #Change Log
1
+ # Change Log
2
2
  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
6
  ## [Unreleased]
7
7
 
8
+ ## [1.1.0] - 2017-07-17
9
+ ### Added
10
+ - Option to limit the number of lines to be parsed from the dmesg output
11
+ - Option to specify what pattern (regex) to look for in the dmesg output
12
+
8
13
  ## [1.0.0] - 2017-06-14
9
14
  ### Added
10
15
  - Support for Ruby 2.3 and 2.4 (@eheydrick)
@@ -35,7 +40,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
35
40
  ### Changed
36
41
  - removed cruft from /lib
37
42
 
38
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-hardware/compare/1.0.0...HEAD
43
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-hardware/compare/1.1.0...HEAD
44
+ [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-hardware/compare/1.0.0...1.1.0
39
45
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-hardware/compare/0.0.4...1.0.0
40
46
  [0.0.4]: https://github.com/sensu-plugins/sensu-plugins-hardware/compare/0.0.3...0.0.4
41
47
  [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-hardware/compare/0.0.2...0.0.3
@@ -25,13 +25,39 @@
25
25
  # for details.
26
26
  #
27
27
 
28
+ require 'English'
28
29
  require 'rubygems' if RUBY_VERSION < '1.9.0'
29
30
  require 'sensu-plugin/check/cli'
30
31
 
31
32
  class CheckHardwareFail < Sensu::Plugin::Check::CLI
33
+ option :lines,
34
+ short: '-l NUMBER',
35
+ long: '--lines NUMBER',
36
+ proc: proc(&:to_i),
37
+ default: 0,
38
+ description: 'Maximum number of lines to read from dmesg, 0 (default) means all'
39
+
40
+ option :query,
41
+ short: '-q QUERY',
42
+ long: '--query QUERY',
43
+ default: 'Hardware Error',
44
+ description: 'What to look for in the output of dmesg'
45
+
46
+ option :invert,
47
+ long: '--invert',
48
+ description: 'Invert order',
49
+ boolean: true,
50
+ default: false
51
+
32
52
  def run
33
- errors = `dmesg`.lines.select { |l| l['[Hardware Error]'] }
34
- critical 'Hardware Error Detected' if errors.any?
35
- ok 'Hardware OK'
53
+ cmd = config[:invert] ? 'head' : 'tail'
54
+ errors = if config[:lines] == 0
55
+ `dmesg`.lines.select { |l| l[/#{config[:query]}/] }
56
+ else
57
+ `dmesg | #{cmd} -n #{config[:lines]}`.lines.select { |l| l[/#{config[:query]}/] }
58
+ end
59
+ unknown 'Command execution failed!' unless $CHILD_STATUS.success?
60
+ critical "Problem Detected: #{config[:query]}" if errors.any?
61
+ ok 'OK'
36
62
  end
37
63
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsHardware
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-hardware
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
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-06-15 00:00:00.000000000 Z
11
+ date: 2017-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin