Sha256: 76814db0a0cb13719b12fac5335d80ca0163e95952f64d0fdcc2724fbf03c868

Contents?: true

Size: 618 Bytes

Versions: 42

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

42 entries across 42 versions & 1 rubygems

Version Path
riemann-babbler-1.0.7.9 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.7.8 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.7.7 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.7.5 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.7.4 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.1.0pre2 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.7.3 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.7.2 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.7.1 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.7 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.6 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.5.7 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.5.6 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.5.5 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.5.4 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.5.3 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.5.2 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.5.1 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.5 lib/riemann/babbler/plugins/mdadm.rb
riemann-babbler-1.0.4 lib/riemann/babbler/plugins/mdadm.rb