[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [monit] Process without pidfile - cannot script
From: |
Martin Pala |
Subject: |
Re: [monit] Process without pidfile - cannot script |
Date: |
Fri, 12 Mar 2010 10:50:28 +0100 |
On Mar 12, 2010, at 1:36 AM, Adam Nielsen wrote:
>> yes, monit requires pidfile ... you can still watch the parent
>> process of smbd childs - the 'totalcpu' and 'totalmem' allows to
>> react to total cpu and memory usage of all smbd's sub-processes, the
>> 'children' statement allows to check sub-processes count.
>
> Ah ok, unfortunately that's not going to work too well as I don't want to
> boot off all 50 users when only one has a problem.
>
> Is there any way I can say "only do it between 2am and 3am"?
>
> Thanks,
> Adam.
You can try something like this:
check process smbd with pidfile /opt/samba/var/locks/smbd.pid
start program = "/etc/init.d/smbd start"
stop program = "/etc/init.d/smbd stop"
if totalcpu > 90% for 5 cycles then exec "/bin/bash -c '/bin/ps -eo
pcpu,pid,args | /usr/bin/awk '$0 ~ /smbd/ && $1 > 80 {print $2}' | xargs -i
kill {}'"
=> if total cpu usage of smbd and all its sub-processes exceeds 90%, the exec
script will kill all smbd processes which take more then 80% of cpu
Regards,
Martin