RAILS_ROOT = File.dirname(File.dirname(__FILE__)) def generic_monitoring(w, options = {}) w.start_if do |start| start.condition(:process_running) do |c| c.interval = 10.seconds c.running = false end end w.restart_if do |restart| restart.condition(:memory_usage) do |c| c.above = options[:memory_limit] c.times = [3, 5] # 3 out of 5 intervals end restart.condition(:cpu_usage) do |c| c.above = options