sensu-plugins-hardware 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -2
- data/bin/check-hardware-fail.rb +29 -3
- data/lib/sensu-plugins-hardware/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec6fc7437d99045ad6597bccfb65c1cd7741a326
|
4
|
+
data.tar.gz: 53c98ddd65cc5a7c1e1240bca0680135247b027c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a92fb5d6832dbbc241bf75c3ead01cdf30b34e3f40ee5defedc6c6506a12846cb1ed6d6044b5cf2342c655c3a6c917e9b7ae627a1e6ded06e7c39a5dba3496b
|
7
|
+
data.tar.gz: 09766fe5a187addb0e4e30c649ff833eddd34f90919d005a9b7eddd120345c807c1ae1ce86799e0efc41ef399e2086acbed034fbc80e3327459eb65cd0d00c11
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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
|
data/bin/check-hardware-fail.rb
CHANGED
@@ -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
|
-
|
34
|
-
|
35
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|