lib/riemann/babbler/plugins/runit.rb in riemann-babbler-1.0.8.8 vs lib/riemann/babbler/plugins/runit.rb in riemann-babbler-1.1.0pre2
- old
+ new
@@ -13,19 +13,17 @@
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\//, '')
+ human_srv = ' ' + srv.gsub(/\/etc\/service\//,"")
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_history.delete "human_srv"
status << {:service => plugin.service + human_srv , :state => 'ok', :description => "runit service #{human_srv} running"}
else
- if @status_history.include? human_srv
- status << {:service => plugin.service + human_srv , :state => 'critical', :description => "runit service #{human_srv} not running"}
- end
+ 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
end
end
status
end