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: David Campbell
Subject: Re: [monit] restart service if swap or real ram is below a thresgold
Date: Sat, 17 Nov 2007 23:03:47 +0000
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Martin Pala wrote:
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:

Basically I have a memory leak that will be fixed but until then I need a short term fix.


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

The problem here surely is that 2.6 Linux kernel will buffer as much memory as is needs, so 95% wouldn't that unusual on our servers.


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<--

Thanks, that is helpful.

Dave




reply via email to

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