Monit 与 exec 一起使用警报

Ale*_*der 7 monit

我有这样的规则:

if memory usage > 85% for 10 cycles then alert
Run Code Online (Sandbox Code Playgroud)

我不仅想通过电子邮件通知,还想通过 slack 通知。所以我可以像这样添加第二行:

if memory usage > 85% for 10 cycles then exec /path/to/slack.rb
Run Code Online (Sandbox Code Playgroud)

当您有多个规则并且必须复制每一行时,这很烦人。可以一起使用alert和exec吗?像这样的东西:

if memory usage > 85% for 10 cycles then alert and exec /path/to/slack.rb
Run Code Online (Sandbox Code Playgroud)

小智 3

在这种情况下,不需要有两个规则。第二个(带有exec)就足够了。如果您已set alert配置 monit,则会在匹配限制时提醒您。但如果您不想收到警报,请使用附加规则noalert your@email