Sha256: b14eec0042de3a29042d4466d737f3e3b685e072ae2a08777af65a476932ce3e

Contents?: true

Size: 766 Bytes

Versions: 3

Compression:

Stored size: 766 Bytes

Contents

#! /usr/bin/env ruby
#
#   check-hardware-fail
#
# DESCRIPTION:
#   Check dmesg for failing hardware
#   Detects things like overheating CPUs, dying hard drives, etc.
#
# OUTPUT:
#   plain text
#
# PLATFORMS:
#   Linux
#
# DEPENDENCIES:
#   gem: sensu-plugin
#
# USAGE:
#
# NOTES:
#
# LICENSE:
#   Shank Feek, Alan Smith
#   Released under the same terms as Sensu (the MIT license); see LICENSE
#   for details.
#

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

    ok 'Hardware OK'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sensu-plugins-hardware-0.0.3 bin/check-hardware-fail.rb
sensu-plugins-hardware-0.0.2 bin/check-hardware-fail.rb
sensu-plugins-hardware-0.0.1 bin/check-hardware-fail.rb