bin/check-hardware-fail.rb in sensu-plugins-hardware-0.0.3 vs bin/check-hardware-fail.rb in sensu-plugins-hardware-0.0.4
- old
+ new
@@ -28,14 +28,10 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'sensu-plugin/check/cli'
class CheckHardwareFail < Sensu::Plugin::Check::CLI
def run
- errors = `dmesg`.lines.grep(/\[Hardware Error\]/)
- # #YELLOW
- unless errors.empty? # rubocop:disable IfUnlessModifier
- critical 'Hardware Error Detected'
- end
-
+ errors = `dmesg`.lines.select { |l| l['[Hardware Error]'] }
+ critical 'Hardware Error Detected' if errors.any?
ok 'Hardware OK'
end
end