God::Contacts::Email.defaults do |d|
d.from_email = 'nor...@host.com'
d.from_name = 'Monitor'
d.delivery_method = :smtp
d.server_host = 'host.com'
d.server_auth = true
d.server_domain = 'host.com'
d.server_user = 'in...@host.com'
d.server_password = 'pass'
end
God.contact(:email) do |c|
c.name = 'me'
c.group = 'system'
c.to_email = 'in...@host.com'
end
God.contact(:prowl) do |p|
p.name = 'xxx'
p.apikey = 'xxx'
end
God.watch do |w|
w.name = "simple"
w.interval = 5.seconds
w.start = "ruby /tmp/simple.rb"
w.keepalive
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
w.transition(:init, { true => :up, false => :start }) do |on|
on.condition(:process_running) do |c|
c.running = true
end
end
# determine when process has finished starting
w.transition([:start, :restart], :up) do |on|
on.condition(:process_running) do |c|
c.running = true
end
end
# start if process is not running
w.transition(:up, :start) do |on|
on.condition(:process_exits)
end
# # bind the notification via mail when some problems occours
w.transition(:up, :start) do |on|
on.condition(:process_exits) do |p|
p.notify = 'xxx'
end
end
end