Sha256: bf8e431d578f8517d806d2119bb497b0e472be4204f5a5431648e8a6a87a5dff

Contents?: true

Size: 705 Bytes

Versions: 2

Compression:

Stored size: 705 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.select { |l| l['[Hardware Error]'] }
    critical 'Hardware Error Detected' if errors.any?
    ok 'Hardware OK'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sensu-plugins-hardware-1.0.0 bin/check-hardware-fail.rb
sensu-plugins-hardware-0.0.4 bin/check-hardware-fail.rb