lib/riemann/babbler/plugins/runit.rb in riemann-babbler-0.9.8 vs lib/riemann/babbler/plugins/runit.rb in riemann-babbler-0.9.9

- old
+ new

@@ -14,10 +14,12 @@ 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\//,"") - if File.read( File.join(srv, 'supervise', 'stat') ).strip == 'run' + stat_file = File.join(srv, 'supervise', 'stat') + next unless File.exists? stat_file + if File.read( stat_file ).strip == 'run' @status_history.delete "human_srv" status << {:service => plugin.service + human_srv , :state => 'ok', :description => "runit service #{human_srv} running"} else status << {:service => plugin.service + human_srv , :state => 'critical', :description => "runit service #{human_srv} not running"} if @status_history.include? human_srv @status_history << human_srv unless @status_history.include? human_srv