trish
(trish)
2 May 2022 07:02
1
Is monit still capable of email alerts?
I setup mail service in System-Mailservice, and I get test emails
I even get APC-UPS alerts with email.
For some unknown reason, I can’t get Monit to send emails. I set it up in /etc/monitrc
set mailserver mail.google.com port 465
username “login”
password “password000”
using auto
Where would you see any anomalies regarding Monit trying to send emails?
I am using @jon 's firewall alerts. and they work pretty good, I see them in System Logs but no emails.
If you’ve installed the IPFire addon named monit , then you can add this to the config file to monitor outgoing DROP_HOSTILE events:
# review messages log
check file messageLog path /var/log/messages
ignore content = ".*monit.*"
# review messages log for DROP_HOSTILE
# but do not look at red0
if content = "DROP_HOSTILE IN=(blue0|green0|orange0)"
then alert
EDIT: temporarily add a space to test so test can pickup non-red0 content.
if content = "DROP_HOSTILE IN=( |blue0|green0|orange0)"
…
jon
(Jon)
2 May 2022 13:56
2
this is what I have for gmail:
SET MAILSERVER
smtp.gmail.com
PORT 587
USERNAME <username without domain>
PASSWORD <password>
using tls
and then this:
SET ALERT example@gmail.com with reminder on nn cycles
1 Like
trish
(trish)
4 May 2022 05:44
3
Thanks Jon, I forgot to use
SET ALERT...
now it’s trying to send but looks like has a bug:
12:02:45 monit[2041]: SMTP: Mailserver response error -- 550-The mail server does not recognize monit@ ipfire.lan as a valid sender.
12:02:46 monit[2041]: Alert handler failed, retry scheduled for next cycle
that is seems to be a bug in “monit” because
I have
set mail-format {
from: ipfire@mailserver.com
even after reload, and restart
jon
(Jon)
4 May 2022 15:57
4
here is my mail-format. This is what I’ve used and it works !
SET MAIL-FORMAT {
from: Monit <monit@$HOST>
subject: Monit alert on $HOST -- $EVENT $SERVICE
message: $EVENT on the service: $SERVICE
Date: $DATE
Action: $ACTION
Host: $HOST
Description: $DESCRIPTION
}
Nothing has been changed above. Try adding this to your file exactly as-is and see if it works.
trish
(trish)
6 May 2022 05:25
5
Thanks for trying Jon
I copied it exactly as-is and got an error:
root@IPFIRE # monit reload
'etc/monitrc:65: invalid mail format '
'etc/monit.d/monit2.cfg:67: syntax error 'subject: Monit alert on $HOST -- $EVENT $SERVICE
jon
(Jon)
6 May 2022 14:48
6
In the first error:
It points to the etc/monitrc file and line 65 . Open the etc/monitrc
file and check the line 65 (and maybe a few above).
EDIT :
As a general practice with monit – Before doing a reload do a monit -t
to check the configuration files.
2 Likes
trish
(trish)
6 May 2022 17:02
7
Thank you,
I just redid the whole monitrc file,
and monit -t is very useful thank you again
trish
(trish)
6 May 2022 17:08
8
Unfortunately mail server is refusing to send the alerts because the
“sender” (monit@IPFIRE.lan) is not a valid email address (ipfire@email.com )
Mail: Mailserver response error -- 550-Verification failed for <monit@IPFIRE.lan>
monit[13539]: SMTP: Mailserver response error -- 550-The mail server does not recognize monit@ ipfire.lan as a valid sender.
jon
(Jon)
6 May 2022 17:29
9
I am not sure… (this is beyond my skills)
You’ll probably need to contact monit support for assistance or do a giggle search for the error.
1 Like