Sha256: bfb9d6ccb5348bb489559005db69881b2699ffc2b011444380b297c1a505e219

Contents?: true

Size: 618 Bytes

Versions: 9

Compression:

Stored size: 618 Bytes

Contents

class Riemann::Babbler::Mdadm < Riemann::Babbler

  def init
    plugin.set_default(:service, 'mdadm')
    plugin.set_default(:interval, 60)
    plugin.states.set_default(:critical, 1)
  end

  def run_plugin
    File.exists? '/proc/mdstat'
  end

  def collect 
    file = File.read('/proc/mdstat').split("\n")
    status = Array.new
    file.each_with_index do |line, index|
      next unless line.include? '_'
      device = file[index-1].split(':')[0].strip
      status << { :service => plugin.service + " #{device}", :metric => 1, :description => "mdadm failed device #{device}" }
    end
    status
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
riemann-babbler-1.0.8.8 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.8.7 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.8.6 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.8.5 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.8.4 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.8.3 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.8.2 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.8.1 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.8 lib/riemann/babbler/plugins/mdadm.rb