monit:在IF构造中添加NOALERT

debian jessie上,我已经configuration了HAproxy来检查HAproxy特定的端口转发,如果失败像这样重新启动它:

 check process haproxy with pidfile /run/haproxy.pid group www-data start program = "/bin/systemctl start haproxy.service" stop program = "/bin/systemctl stop haproxy.service" if failed port 8080 protocol http request "/checker" then restart if failed port 8081 protocol http request "/checker" then restart if failed port 8082 protocol http request "/checker" then restart if 8 restarts within 8 cycles then unmonitor 

我知道可以在特定的check环境中设置noalert email 。 我想知道如果在同样的check是否可以做同样的事情。 在这个特殊的情况下,我希望只有在port 8082检查失败的时候才会通知我,而另外两个port 8082则不会。

我试图添加这样的东西:

 check process haproxy with pidfile /run/haproxy.pid group www-data start program = "/bin/systemctl start haproxy.service" stop program = "/bin/systemctl stop haproxy.service" if 8 restarts within 8 cycles then unmonitor check host site-a with address localhost noalert email@address depends haproxy if failed port 8080 protocol http request "/checker" then exec "/usr/bin/monit restart haproxy" check host site-b with address localhost noalert email@address depends haproxy if failed port 8081 protocol http request "/checker" then exec "/usr/bin/monit restart haproxy" check host site-c with address localhost depends haproxy if failed port 8082 protocol http request "/checker" then exec "/usr/bin/monit restart haproxy" 

这个configuration可以工作,但是我需要像外部程序那样exec monit ,我想知道是否有办法在同一个check中的if construct直接执行它。 如果我使用下面的方法, monit会开始没有抱怨,但它不考虑noalert指示:

 check process haproxy with pidfile /run/haproxy.pid group www-data start program = "/bin/systemctl start haproxy.service" stop program = "/bin/systemctl stop haproxy.service" if failed port 8080 protocol http request "/checker" then restart noalert email@address if failed port 8081 protocol http request "/checker" then restart noalert email@address if failed port 8082 protocol http request "/checker" then restart if 8 restarts within 8 cycles then unmonitor 

任何想法?

最好的祝福