0

I've written a script which sends me an sms notification. I call with exec action in monit test. It works, but I'm getting overwhelmed by messages. Is there a way to suppress sending subsequent messages if check fails until it succeeds?

Here is the monit config file:

check system my_host
    if loadavg (1min) > 3 then alert
    if loadavg (1min) > 3 then exec "/usr/local/sms_notifier/sms_notifier.php all cpu load average exceeds 3" as uid nobody and gid sms
    if loadavg (5min) > 2 then alert
    if memory usage > 90% then alert
    if memory usage > 90% then exec "/usr/local/sms_notifier/sms_notifier.php all memory usage exceeds 90%" as uid nobody and gid sms
    if cpu usage (user) > 70% then alert
    if cpu usage (system) > 30% then alert
    if cpu usage (wait) > 30% then alert
3
  • Please show your monit configuration file.
    – ewwhite
    Oct 3, 2012 at 16:00
  • Maybe add something like [[<X>] [TIMES WITHIN] <Y> CYCLES] to your tests so you only trigger the alert if your issue is continuous, and not an intermittent spike? Or perhaps adjust your thresholds.
    – Zoredache
    Oct 3, 2012 at 16:39
  • loadavg 3 for a minute is the precise sign of something terrible in my case. I want to be noticed immediately, but I really don't need dozens of sms for one such event. Sole message is good enough. Oct 3, 2012 at 19:10

1 Answer 1

0

You need to add "cycles" to your config.

check system localhost
    if loadavg (15min) > 8 for 10 cycles then alert

See the Monit service test documentation.

1
  • Well, I'm not talking about alerts here. They are not repeated. I get one message when an event occurs and another when check succeeds again. Execs keep spamming me. I didn't set cycles option because it would increase the latency and I want to be notified asap. Oct 3, 2012 at 19:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .