how to do multiple notifications possible?

39 views
Skip to first unread message

rubybox

unread,
Oct 31, 2012, 10:10:24 AM10/31/12
to god...@googlegroups.com


Would it be possible to do multiple notifications?
Cannot get it to work, I need mail + prowl only 1 at the time works.


Ive created a simple.rb deamon to test with this code:


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

Reply all
Reply to author
Forward
0 new messages