Hello all,
I am new to the mailing list and to God.rb and am having issues getting email to send via mailjet when an event occurs. Unfortunately I am not seeing anything in the log file related to email (or much of anything else) so I am not sure how to debug my issue.
God does successfully restart my process when it is turned off, but I don't get a notification of the restart ever happening.
Here is what I have so far in my config file:
God::Contacts::Email.defaults do |d|
d.from_email = 'em...@example.com'
d.from_name = 'God Notification'
d.delivery_method = :smtp
d.server_host = 'in-v3.mailjet.com'
d.server_port = 587
d.server_auth = true
d.server_domain = 'example.com'
d.server_user = 'api key'
d.server_password = 'api secret'
end
God.contact(:email) do |c|
c.name = 'Vell'
c.group = 'developers'
c.to_email = 've...@example.com'
end
God.watch do |w|
w.name = "mysql"
w.group = 'system'
w.interval = 1.minute # default
w.start = "service mysql start"
w.stop = "service mysql stop"
w.restart = "service mysql restart"
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
w.pid_file = "/var/run/mysqld/mysqld.pid"
w.keepalive
w.behavior(:clean_pid_file)
w.transition(:up, :restart) do |on|
on.condition(:memory_usage) do |c|
c.interval = 20
c.above = 100.megabytes
c.times = [3, 5]
c.notify = {contacts: ['developers'], priority: 1, category: 'staging'}
end
on.condition(:cpu_usage) do |c|
c.interval = 10
c.above = 50.percent
c.times = [3, 5]
c.notify = {contacts: ['developers'], priority: 1, category: 'staging'}
end
end
end
Now that I am looking at this, my guess is, I am not meeting the conditions for an email to be sent out? But what condition can I right to trigger an email just on the restart that has nothing to do with memory or cpu usage? Is it simply
on.condition(:restart) do |c|
...
end
Any advice is greatly appreciated.
Thanks