monit-general
[Top][All Lists]
Advanced

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

Re: How to repeat alert notification


From: Guillaume François
Subject: Re: How to repeat alert notification
Date: Thu, 26 Jan 2017 18:40:34 +0100

Documentation https://mmonit.com/documentation/mmonit_manual.pdf at page 56 states:

Reminder. 
M/Monit will usually only send one alert if a service fails and not continue to send alerts as long as the service is in the 
same error state. Sometimes, it can be useful to get a reminder if a service continue to stay in the same error state. Click the 
ℹ  icon to the right of the input field, a panel will popup from where you can setup the reminder alert.

Have fun with monit.

2017-01-26 18:28 GMT+01:00 Guillaume François <address@hidden>:
Unfortunalty, I'm not using M/Monit, not even on my personal server. For production, it is more an management issue but based on time I spend trying to help the community, the counterpart is honest.

(But if Martin Pala is willing to provide discount for only one personal host use ;-), I really don't need 5 hosts )

From my point of view the "repeat" should be set at M/Monit side so maybe you can set it there (Alert-> Rules ?)

Else ask for a new feature 😋. 
Tildeslash is composed of people very open and usually they are willing to implement good suggestion from users. 

Bonus: Based on M/Monit wiki it could also be done only at Monit level, look for the last section at  https://mmonit.com/wiki/MMonit/SlackNotification comining an exec and repat as detailed before.

BR

2017-01-26 18:14 GMT+01:00 Riccardo Leonardi <address@hidden>:
I've seen this syntax but as in my previous answer, monitored server should notify to m/monit server only, so email is not a valid alerting method in my scenario.

As far as I know there is no reminder implementation on alert action; in facts it's exactly what I need....


    
Il 26/01/2017 18:04, Guillaume François ha scritto:
Sorry it came to my mind after I hit sent button but we got a similar question somewhere recently and there exist another pattern also I'm using

alert address@hidden with reminder on 15 cycles


check program check1 with path "/var/lib/monit/scripts/checkManualValidationLate.sh" not every "* 9-21 * * *"
if status != 0 for 2 cycles then alert
alert address@hidden with reminder on 15 cycles
alert address@hidden with reminder on 10 cycles
alert address@hidden with reminder on 5 cycles


2017-01-26 17:55 GMT+01:00 Guillaume François <address@hiddenm>:
Hi 

In my case, I use a custom script to alert and Notify at the same time like below

if does not exist then exec "/var/lib/monit/scripts/notifyAndExecute.sh /bin/mount /path/to/remount" else if succeeded then exec "/var/lib/monit/scripts/notifySuccess.sh"

This way I can alert by using what ever channel (email;,sms, webhook etc...) and run command at the same time. 

I did this because in the the past monit didn't supported several rules but Monit evolved and you can now defined several rules for one event like below (in the past it was overwriting/ignored)

if does not exist for 3 cycles then alert
if does not exist for 5 cycles then start 
if failed port 8080 for 3 times within 4 cycles then alert
if failed port 8080 for 6 times within 8 cycles then restart
if failed port 8443 for 3 times within 4 cycles then alert
if failed port 8443 for 6 times within 8 cycles then restart
if failed port 9990 for 3 times within 4 cycles then alert
if failed port 9990 for 6 times within 8 cycles then restart


if does not exist for 10 cycles then alert
if does not exist for 5 cycles then exec "/bin/mount /mnt/nfs"

I don't have samples, but from my memory, you can also define several actions for the same "event" several times with newer version like below

if does not exist for 5 cycles then alert repeat every 2 cycles
if does not exist for 5 cycles then exec "/bin/mount /mnt/nfs" repeat every 3 cycles
if does not exist for 5 cycles then exec "/some/script/notify" repeat every 3 cycles


In your case it would be something like (not tested)

if status != 0 then exec "/usr/local/monit/conf/dummy.sh" repeat every 10 cycles
if status != 0 then alert repeat every 10 cycles

Hope this help.


2017-01-26 17:16 GMT+01:00 Riccardo Leonardi <address@hidden>:
Hi,

thank you for your answer.
I've checked the syntax about repeat feature, and it works (I have 5.20.0).
Unfortunately what I need is not the script execution: that's is ok.
What I need is repeat of alert notification, and as far as I know this notification is sent when the state changes only: OK->Failure and Failure->OK.
As workaround I could explore some configuration at server side or forging some explicit signal by the script that is run every x cycles (see dummy.sh in my example), but I don't know how to do it.

Thansk again
Pensare Web srl, via Macanno | 38/N
47923 Rimini RN (Italy)
T. 0541 309547 | F. 0541 1646143 
Il 26/01/2017 16:56, Guillaume François ha scritto:
Hi,


Could it be an issue related to the version of Monit you're using ?

Changelog (https://mmonit.com/monit/changes/) shows the behavior was changed in 5.16.0 as before it was forced to "repeat every 1 cycle".

Therefore this syntax was not supported before.

Best Regards.

2017-01-26 16:27 GMT+01:00 Riccardo Leonardi <address@hidden>:
Hi,

I have a script checking mail queue returning alert if queue lenght is greather than some threshold.

The alert is correctly forwarded to slack channel, but when the threshold is reached only, not when the queue remains over the threshold.

In fact the behaviour I'd like to implement is:
- receive the alert when the queue goes over the threshold
- continue receiving the alert (possibly with current queue lenght) every x cycles
- stop receiving when the queue returns under the threshold

Currently I have implemented the following:

check program qlen_check with path "/usr/local/monit/conf/check_qlen.sh 200"
    if status != 0 then exec "/usr/local/monit/conf/dummy.sh" repeat every 10 cycles

The script check_qlen.sh echoes queue lenght and return 1 if queue > 200.
As soon as that happens I got 1 slack alert only, while I'd like to keep receiving it every x cycles (when dummy.sh is correctly run).

Does anyone have any suggestion how to achieve that behaviour?

Thank you in advance.

Rik

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general



--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--? w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-) DI !D- G(+)>+ e+++ h--() r->$ y?*
------END GEEK CODE BLOCK------


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
--
-----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--? w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-) DI !D- G(+)>+ e+++ h--() r->$ y?* ------END GEEK CODE BLOCK------
--
-----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--? w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-) DI !D- G(+)>+ e+++ h--() r->$ y?* ------END GEEK CODE BLOCK------
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general



--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--? w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-) DI !D- G(+)>+ e+++ h--() r->$ y?*
------END GEEK CODE BLOCK------



--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--? w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-) DI !D- G(+)>+ e+++ h--() r->$ y?*
------END GEEK CODE BLOCK------

reply via email to

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