monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quietly restart process, alert only if restart fails?


From: Martin Pala
Subject: Re: Quietly restart process, alert only if restart fails?
Date: Fri, 28 Oct 2011 03:56:42 +0200

Hi,

you can suppress the alerts for exceeded resource usage and non-existent 
processs if you want and let the restart counter send the alert, for example:

--8<--
set alert address@hidden but not on { resource nonexist }

check worker_process  with pidfile /var/run/worker_process.pid
  start program = "/my/start/script"
  stop program = "/my/stop/script"
  if totalmem is greater than 300MB for 5 cycles then restart
  if 3 restarts within 3 cycles then alert
--8<--

=> 
1.) the "set alert" filters out the alert on exceeded "resource" usage (memory 
in this case) and "nonexist" process
2.) the "if 3 restarts within 3 cycles then alert" will generate event in the 
after 3 restarts which is not filtered out by above mentioned settings
3.) the "if does not exist" statement is not necessary - with above 
configuration monit will by default restart the process if it is not running

Regards,
Martin



On Oct 27, 2011, at 6:58 PM, Simon Coffey wrote:

> Hi all,
> 
> I have a worker process that frequently balloons in memory usage
> ordies, requiring a restart. This happens often enough (and
> therestarting is reliable enough) that the alert mails are a
> constantsource of noise, leading to their being tuned out by the team.
> I would like to achieve the following:
> 1) If process exceeds 300MB memory for 5 cycles, attempt silent
> restart2) If the restart fails (so, say, if process doesn't exist for
> 3+cycles), *then* send a nonexist alert
> Is this possible? I've tried the following:
> check worker_process  with pidfile /var/run/worker_process.pid  start
> program = "/my/start/script"  stop program = "/my/stop/script"  if
> totalmem is greater than 300MB for 5 cycles then restart  if does not
> exist then restart  if does not exist for three cycles then alert
> But it seems you can only have one clause for each type of condition
> -one of the "if does not exist" clauses will be ignored.
> Another alternative might be to have two checks on the same process
> -one to restart, and one to alert - but this seems like a
> horribleduplication of configuration; surely there's a more elegant
> solution.
> If anyone's got any ideas, I'd be very grateful, as would my team
> andtheir inboxes... :-)
> Simon
> -- 
> Simon Coffey
> Developer, Tribesports
> address@hidden | 07960 004 857
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

[Prev in Thread] Current Thread [Next in Thread]