Sha256: ae9d8108941f8cbf39799b1d01a496491adc80fc36b39962282c38eb4979e52a

Contents?: true

Size: 730 Bytes

Versions: 5

Compression:

Stored size: 730 Bytes

Contents

class Riemann::Babbler::Runit < Riemann::Babbler

  def init
    plugin.set_default(:service, 'runit')
    plugin.set_default(:not_monit, [])
    plugin.set_default(:interval, 60)
  end

  def run_plugin
    Dir.exists? '/etc/service'
  end

  def read_run_status
    status = Array.new
    Dir.glob('/etc/service/*').each do |srv|
      next if plugin.not_monit.include? srv
      human_srv = ' ' + srv.gsub(/\/etc\/service\//,"")
      unless File.read( File.join(srv, 'supervise', 'stat') ).strip == 'run'
        status << {:service => plugin.service + human_srv , :state => 'critical', :description => "runit service #{human_srv} not running"}
      end
    end
    status
  end

  def collect
    read_run_status
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
riemann-babbler-0.9.6 lib/riemann/babbler/plugins/runit.rb
riemann-babbler-0.9.5 lib/riemann/babbler/plugins/runit.rb
riemann-babbler-0.9.4 lib/riemann/babbler/plugins/runit.rb
riemann-babbler-0.9.3 lib/riemann/babbler/plugins/runit.rb
riemann-babbler-0.9.2 lib/riemann/babbler/plugins/runit.rb