Hi Nitesh. Sure you can.
You can find examples in the god homepage but i'll leave you one. You just
need to wrap your conditions in a block.
w.restart_if do |restart|
#Custom conditon
restart.condition(:log_watcher) do |c|
c.monitor_file w.log.to_s
c.add_regexp(/.+OutOfMemory.+/)
end
#Built-in god conditon
restart.condition(:memory_usage) do |c|
c.above = 100.megabytes
c.times = [3, 5] #3 out of 5 measurements
end
#Built-in god conditon
restart.condition(:cpu_usage) do |c|
c.above = 98.percent
c.times = 3 # 3 consecutive measurements
end
end
Happy monitoring.
Best regards,
Nuno Valente.
On Mon, May 7, 2012 at 9:47 AM, Nitesh Goel <[email protected]> wrote:
> Hey Guys
> I am monitoring a process where my restart command is based on the restart
> condition failed. E.g.
>
> If memory usage too high:
>
> w.restart = "command 1"
>
> if cpu usage too high:
>
> w.restart = "command 2"
>
> Is there a way to configure a watch as such?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "god.rb" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/god-rb/-/bgMHE_OZ-rcJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/god-rb?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"god.rb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/god-rb?hl=en.