Igor
Igor

Reputation: 319

Monit - stop receiving emails about monit reload

Is there any way to stop receiving e-mails about reloading "monit" service?

This is current config in /etc/monit.d/config (and mydomain.com is my machine):

*

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'

*

But since I am having logrotation every hour which is reloading services, monit is sending e-mails every hour:

This is start: Monit reloaded [system_localhost.localdomain], mydomain.com

This is stop: Monit stopped [mydomain.com], mydomain.com

How to stop receiving those e-mails about monit (which I don't want to receive)?

Thanks in advance!

Upvotes: 3

Views: 2434

Answers (2)

Andrei Coșcodan
Andrei Coșcodan

Reputation: 717

To receive all alerts except notification about Monit program start and stop:

set alert [email protected] not {instance}

Upvotes: 0

Ulugbek
Ulugbek

Reputation: 164

By default, monit will alert for every action, but luckily, it also allows you to set the event filter, so you don't receive alerts as frequently as you do.

You can set the event filter to only send alerts when your process does not exist like this:

set alert [email protected] only on { nonexist }

For a full list of available events and setting a filter, check the documentation: https://mmonit.com/monit/documentation/monit.html#Setting-an-event-filter

Upvotes: 1

Related Questions