Monit use alert along with exec

monit

I have rule like this:

if memory usage > 85% for 10 cycles then alert

I want to notify not only via email but also via slack. So I can add second line like this:

if memory usage > 85% for 10 cycles then exec /path/to/slack.rb

It's annoying when you have multiple rules and you have to duplicate each line.
Is it possible to use alert and exec together? Something like this:

if memory usage > 85% for 10 cycles then alert and exec /path/to/slack.rb

Best Answer

In this case, there is no need to have two rules. The second one (with exec) is enough. If you have set alert configured monit will alert you when a limit is matched. But if you don't want to receive an alert, use an additional rule noalert your@email.