有什么方法可以停止接收有关重新加载“监视”服务的电子邮件?

这是/etc/monit.d/config中的当前配置(而mydomain.com是我的机器):

*

check system mydomain.com
check process script_name with pidfile /home/user/scripts/script-pid
start program = "/etc/init.d/script_name start" with timeout 60 seconds
stop program  = "/etc/init.d/script_name stop"
set alert [email protected]
set mail-format { from: [email protected] }
set mailserver smtp.mydomain.com,localhost
set mail-format {
    from: [email protected]
    subject: [ $SERVICE ] $EVENT - $DATE
    message: This is $ACTION: $DESCRIPTION [$SERVICE], mydomain.com }
set httpd port 2812 and
     use address localhost  # only accept connection from localhost
     allow localhost        # allow localhost to connect to the server and
     allow admin:monit      # require user 'admin' with password 'monit'

*

但是由于我每小时都会进行logrotation来重新加载服务,因此monit每小时都会发送电子邮件:

这是开始:Monit重新加载[system_localhost.localdomain],mydomain.com

这是停止:Monit已停止[mydomain.com],mydomain.com

如何停止接收有关monit的电子邮件(我不想接收)?

提前致谢!

最佳答案

默认情况下,monit将为每个操作发出警报,但是幸运的是,它还允许您设置事件过滤器,因此您不会像以前那样频繁地收到警报。

您可以将事件过滤器设置为仅在进程不存在时才发送警报,如下所示:

set alert [email protected] only on { nonexist }

有关可用事件的完整列表并设置过滤器,请查看文档:https://mmonit.com/monit/documentation/monit.html#Setting-an-event-filter

关于linux - Monit-停止接收有关Monit重新加载的电子邮件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38623044/

10-11 12:07