monit-general
[Top][All Lists]
Advanced

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

[monit] Re: what triggers resource limit?


From: John Dixon
Subject: [monit] Re: what triggers resource limit?
Date: Tue, 19 May 2009 10:49:34 -0400

What I have done on one of my servers is to add an exec line that does
top and redirects to a file when the specific resource limit is reached.
See below my system.conf out of /etc/monit.d/

check system hostname
if loadavg (5min) > 1 then
        exec "/bin/bash -c '/usr/bin/top -b -n 1
>> /etc/monit.d/status_log;/bin/date >> /etc/monit.d/status_log'"
    if memory usage > 50% then
        exec "/bin/bash -c '/usr/bin/top -b -n 1
>> /etc/monit.d/status_log;/bin/date >> /etc/monit.d/status_log'"
    if cpu usage (user) > 30% then
        exec "/bin/bash -c '/usr/bin/top -b -n 1
>> /etc/monit.d/status_log;/bin/date >> /etc/monit.d/status_log'"
    if cpu usage (system) > 40% then
        exec "/bin/bash -c '/usr/bin/top -b -n 1
>> /etc/monit.d/status_log;/bin/date >> /etc/monit.d/status_log'"
    if cpu usage (wait) > 35% then
        exec "/bin/bash -c '/usr/bin/top -b -n 1
>> /etc/monit.d/status_log;/bin/date >> /etc/monit.d/status_log'"
    group system


With this setup you will get notified and you will get top output in the
status_log file.  I'm sure there's a better way to write this same thing
using the monit config syntax, but this works even if it's not pretty.
You may need to run this setup for a few days before you catch what is
using the resources because of timing, etc.  Remember to clear out your
status_log periodically or add it to a logrotate setup.
> Hello,
> i've got a problem with monit, i configure it to alert me when cpu usage is 
> too 
> important, and i've got this mail :
> 
> Resource limit matched Service Intranet
>       Date:        Mon, 18 May 2009 04:13:24 +0200
>       Action:      alert
>       Host:        tamtam
>       Description: 'Intranet' cpu user usage of 70.4% matches resource limit 
> [cpu 
> user usage>70.0%]
> 
> Resource limit matched Service Intranet
>       Date:        Mon, 18 May 2009 04:13:25 +0200
>       Action:      alert
>       Host:        tamtam
>       Description: 'Intranet' loadavg(5min) of 2.2 matches resource limit 
> [loadavg(5min)>2.0]
> 






reply via email to

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