monit-general
[Top][All Lists]
Advanced

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

stopping/starting processes based on loadavg


From: Mike Jackson
Subject: stopping/starting processes based on loadavg
Date: Wed, 18 Jan 2006 14:46:58 -0800

During the last few days, one of the servers I admin has been having some issues receiving massive amounts of mail at once. Since all the mail goes through SpamAssassin, it typically has to spawn more children to handle it. I've been adjusting its max-children value downward to deal with it, but one option I've been considering is having monit kill off spamd temporarily when the load average gets too high, then restart it. Here's my current rule for spamd:

check process spamd with pidfile /tmp/spamd.pid
   start program = "/etc/rc.d/init.d/spamassassin start"
   stop  program = "/etc/rc.d/init.d/spamassassin stop"
   if loadavg(15min) > 5 for 5 cycles then restart
   if failed unixsocket /var/run/spamd.sock then restart
   alert xxx

If I changed the "if loadavg..." line to the following, would it accomplish what I want?

if loadavg(15min) > 5 for 5 cycles then exec "/etc/rc.d/init.d/spamassassin stop" else if passed for 5 cycles then exec "/etc/rc.d/init.d/spamassassin start"

It doesn't appear from the documentation that I can use the built-in stop and start mechanism to resurrect the process when I want it to come back to life when the load average goes down; am I reading that correctly? If I use exec instead, will the "if failed unixsocket..." rule trigger while spamd was stopped based on the loadavg rule?




reply via email to

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