Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get God.rb to send emails #225

Open
vmcilwain opened this issue Nov 17, 2015 · 2 comments
Open

Can't get God.rb to send emails #225

vmcilwain opened this issue Nov 17, 2015 · 2 comments

Comments

@vmcilwain
Copy link

Hello,

I am trying to set up a configuration where God.rb sends an email regardless of what even occurs. Using your events example I have tried the following:

God::Contacts::Email.defaults do |d|
  d.from_email = 'email@example.com'
  d.delivery_method = :smtp
  d.server_host = 'in-v3.mailjet.com'
  d.server_port = 465
  d.server_auth = :plain
  d.server_domain = 'some.domain'
  d.server_user = 'someuser'
  d.server_password = 'somepass'
end

God.contact(:email) do |c|
  c.name = 'Lovell'
  c.group = 'developers'
  c.to_email = 'vmcilwain@example.com'
end

God.watch do |w|
  w.name = "cron"
  w.group = "system"
  w.interval = 1.minute # default
  w.start = "service cron start"
  w.stop = "service cron stop"
  w.restart = "service cron restart"
  w.start_grace = 10.seconds
  w.restart_grace = 10.seconds
  w.pid_file = "/var/run/crond.pid"
  w.keepalive
  w.behavior(:clean_pid_file)

  w.transition(:init, { true: :up, false: :start }) do |on|
    on.condition(:process_running) do |c|
      c.running = true
      c.notify = 'Lovell'
    end
  end

  # determine when process has finished starting
   w.transition([:start, :restart], :up) do |on|
    on.condition(:process_running) do |c|
      c.running = true
      c.notify = 'Lovell'
    end

      # failsafe
    on.condition(:tries) do |c|
      c.times = 8
      c.within = 2.minutes
      c.transition = :start
      c.notify = 'Lovell'
    end
  end
end

Unfortunately, I have not been able to get it so that God.rb tries to send an email when I stop the cron process. It restarts the process fine, but an email notification never gets sent. Curious if this is a bug.

@alexandrecruz
Copy link

I've faced a similar problem. Are you able to send email with any other tool?
When using some cloud providers, smtp ports are blocked by default.

Please, check if its all right with your provider and/or firewall configuration.

@vmcilwain
Copy link
Author

Yes this is definitely not a blocked port. I was using Monit before switching over.

Part of my issue with this is that I don't think I had a good way of testing if God was actually sending me an email. I would create a rule then try to invoke it but was never sure I actually did in order for an notification to be sent.

Sent from my iPhone

On Jan 12, 2016, at 16:50, Alexandre Cruz notifications@github.com wrote:

I've faced a similar problem. Are you able to send email with any other tool?
When using some cloud providers, smtp ports are blocked by default.

Please, check if its all right with your provider and/or firewall configuration.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants