monit-general
[Top][All Lists]
Advanced

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

Re: Soft-alert handler and only alert after X cycles


From: Andrea V.
Subject: Re: Soft-alert handler and only alert after X cycles
Date: Sun, 15 May 2016 16:57:45 +0200

I actually solved the problem already thanks to one entry in this same mailing list:

http://lists.nongnu.org/archive/html/monit-general/2012-02/msg00019.html

It is needed to create two separate checks: one for "soft" actions with a "noalert" statement and the other which will eventually alert via mail.

On Sun, May 15, 2016 at 1:25 PM, Andrea V. <address@hidden> wrote:
Hello everybody!

I have a problem with Monit I am really stuck at, despite several tests and simulation.
I reduced the problem to the following: 

/etc/monit/monitrc:
----
set alert address@hidden but not on { instance }

check system simple-TEST-system
     if cpu usage (user) > 70% then exec '/etc/monit_soft.sh' else if succeeded then exec '/etc/monit_soft.sh' 
     if cpu usage (user) > 70% for 5 cycles then alert
----

What I want to achieve is to execute a script upon  cpu usage (user) > 70% across the system, and only after 5 cycles and only then to alert via a mail.
The actual result though is that I receive a mail on the first cycle already with the following content:

----
Resource limit matched Service simple-TEST-system

Date:        Sun, 15 May 2016 13:15:55
Action:      exec
Host:        simple-TEST-system
Description: cpu user usage of 76.0% matches resource limit [cpu user usage>70.0%]

Your faithful employee,
Monit
----

(note the Action: exec)
And again after 5 cycles I receive another mail with:

----
Resource limit matched Service simple-TEST-system

Date:        Sun, 15 May 2016 13:16:50
Action:      alert
Host:        simple-TEST-system
Description: cpu user usage of 97.9% matches resource limit [cpu user usage>70.0%]

Your faithful employee,
Monit
----

This time the action is "alert" and is the only mail I would like to receive.
What I also tried is to filter out the 'exec' action by specifying:

set alert address@hidden but not on { instance, exec }

This didn't work either to deny the first mail to come in. On the other hand, specifying a filter on 'resource' would deny any alert to be mailed upon that kind of check.

So: how do I prevent monit to alert for an action that just executes a script a form of soft-handling an issue and only properly alert after a few cycles?

Any suggestion will be really appreciated, this problem has been driving me crazy for a week now.

Many thanks!

Andrea


reply via email to

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