notify_when_flapping

38 views
Skip to first unread message

barry.mi...@gmail.com

unread,
Jun 16, 2008, 6:19:48 AM6/16/08
to god.rb
I'm having a few issues getting god to notify me when a process is
flapping. I've been trying to get the notify_when_flapping behavior
working with the following:

w.behavior(:notify_when_flapping) do |nwf|
nwf.failures = 2
nwf.seconds = 20
nwf.notifier = God.contacts["foo"]
end

This is all based on playing around with the god code, so I'm a little
unsure if this is the right way to go about things. The
NotifyWhenFlapping behavior is only valid if "The 'notifier' must have
a method 'notify' which takes 1 or variable args", the email notify
method takes 5 arguments. I've made a few changes to
notify_when_flapping.rb to make this run, and it works, but I'm sure
this shouldn't all be necessary.

Am I missing something here? Has anyone else managed to have god
notify when a process is flapping?

Thanks,

Barry

Aman Gupta

unread,
Jul 7, 2008, 12:37:40 AM7/7/08
to god.rb
Did you have any luck getting notify_when_flapping to work?

Aman

On Jun 16, 3:19 am, "barry.mitchel...@gmail.com"

barry.mi...@gmail.com

unread,
Jul 10, 2008, 8:21:29 AM7/10/08
to god.rb
On Jul 7, 5:37 am, Aman Gupta <themastermi...@gmail.com> wrote:
> Did you have any luck getting notify_when_flapping to work?
>

I still have it working using the changes I mentioned previously, but
as I said before, it doesn't seem the "right" way to get this working.
If anyone has any suggestions or alternative methods then I'd like to
know.

Thanks,

Barry

Tom Werner

unread,
Jul 10, 2008, 12:14:45 PM7/10/08
to god...@googlegroups.com
That behavior is deprecated. To use notifications all you have to do is specify a

c.notify = ...

line in any condition that you want to trigger notification. If you have a contact named 'tom' you can just do

c.notify = 'tom'

or for multiple contacts 'tom' and 'jake' do

c.notify = %w{tom jake}

or take a look here for an even more powerful way to specify

http://github.com/mojombo/god/tree/master/test/configs/contact/contact.god#L58

Tom
--
Tom Preston-Werner
github.com/mojombo

Barry Mitchelson

unread,
Jul 11, 2008, 4:52:03 AM7/11/08
to god...@googlegroups.com
On Thu, Jul 10, 2008 at 5:14 PM, Tom Werner <moj...@gmail.com> wrote:
> That behavior is deprecated. To use notifications all you have to do is
> specify a
>
> c.notify = ...
>
> line in any condition that you want to trigger notification. If you have a
> contact named 'tom' you can just do
>
> c.notify = 'tom'
>
> or for multiple contacts 'tom' and 'jake' do
>
> c.notify = %w{tom jake}
>
> or take a look here for an even more powerful way to specify
>
> http://github.com/mojombo/god/tree/master/test/configs/contact/contact.god#L58
>

Thank you. I've now got it working using the following :

w.transition(:up, :unmonitored) do |on|
on.condition(:flapping) do |c|
c.notify = "barry"
c.to_state = [:start, :restart]
c.times = 5
c.within = 60.seconds
end
end

but I expected to be able to do this:

w.lifecycle do |on|
on.condition(:flapping) do |c|
c.to_state = [:start, :restart]
c.times = 5
c.within = 60.seconds
c.transition = :unmonitored
c.notify = "barry"
end
end

After looking through the code I can see why this doesn't send out the
notification, but is this intended behaviour?

Barry

Reply all
Reply to author
Forward
0 new messages