monit-general
[Top][All Lists]
Advanced

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

Re: [monit] restart service if swap or real ram is below a thresgold


From: Martin Pala
Subject: Re: [monit] restart service if swap or real ram is below a thresgold
Date: Sat, 17 Nov 2007 23:27:27 +0100

Monit monitors just the physical memory usage (no swap).

When the system starts to swap heavily, it is bad for performance no matter how much swap you have. If you know that the memory shortage on you system can be solved by restarting one process, then you should probably check this particular process' memory usage, since there will be most probably relationship. If you are sure that the system wide check is the right solution, the you can use something like this:

--8<--
 check system myhost
    if memory usage > 95% then exec "/bin/pkill badguy"
--8<--

Or if the badguy is monitored by monit, then:

--8<--
 check system myhost
if memory usage > 95% then exec "/bin/bash -c '/usr/bin/monit restart badguy'"

 check process badguy ...
  start ...
  stop ...
--8<--


Martin


On Nov 17, 2007, at 9:28 PM, David Campbell wrote:

Martin Pala wrote:
I think this question is too general.

Sorry, I didn't think it was.

I want to restart a daemon when swap gets below 250Mb.

See monit manual for "check system ..." statement, which allows to monitor total system resources, including memory.

I saw this but I couldn't see how to tie in the check system with restarting a service.

Dave


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general





reply via email to

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