Solved Zabbix - email alerts
-
@Mike-Davis said in Zabbix - email alerts:
and I don't see anything that tells me what Zabbix is looking for under the hood.
It's looking for the local MTA on port 25. Only one service can be the port 25 MTA for the box. That Postfix is running suggests that, but doesn't prove it. But we know that Postfix is listening on port 25, so you know it is Postfix.
Yes, Postfix is standard just about everywhere, it won the MTA wars by far. It's also what we prefer from decades of use.
But this isn't a Linux thing, this is just basic networking. Whatever is listening on port 25 is your email service.
-
@Mike-Davis said in Zabbix - email alerts:
and I don't see anything that tells me what Zabbix is looking for under the hood.
That's because it looks for what you tell it to look for in the email settings that you put in. Zabbix itself does nothing. When you configure to send to localhost port 25, you are telling it to look at the locally running MTA, which in this case is Postfix.
-
Did you look for the errors now that you are using the local Postfix MTA? Your errors are in there, and the fact that the errors are there tell you that Postfix is making the attempt to send email for you.
# cat maillog Feb 14 14:06:10 zabbix postfix/pickup[22265]: 2828F16A1: uid=1132 from=<mdavis> Feb 14 14:06:10 zabbix postfix/cleanup[23637]: 2828F16A1: message-id=<[email protected]> Feb 14 14:06:10 zabbix postfix/qmgr[1352]: 2828F16A1: from=<[email protected]>, size=309, nrcpt=1 (queue active) Feb 14 14:06:11 zabbix postfix/smtp[23639]: 2828F16A1: to=<[email protected]>, relay=ntg-co.mail.protection.outlook.com[207.46.163.74]:25, delay=0.87, delays=0.02/0.01/0.08/0.76, dsn=2.6.0, status=sent (250 2.6.0 <[email protected]> [InternalId=32027571128608, Hostname=BN3PR0801MB2257.namprd08.prod.outlook.com] 6701 bytes in 0.219, 29.877 KB/sec Queued mail for delivery) Feb 14 14:06:11 zabbix postfix/qmgr[1352]: 2828F16A1: removed
-
Check your junk mail and clutter mailboxes, that might have gone through. There was no error on the O365 side (yet).
-
I just made some changes and told it not to use localhost as the smtp server.
-
@Mike-Davis said in Zabbix - email alerts:
I just made some changes and told it not to use localhost as the smtp server.
Well THESE are the logs from the SMTP server. Any changes you make it Zabbix won't be record by the SMTP server. But it looks like the settings I gave you worked are you sure the mail was not delivered?
-
Email is working for me. I'm not seeing your issues.
-
Nothing in the message trace on the office 365 side. I'm adding a gmail address to also get emails to see what happens there.
-
@Mike-Davis said in Zabbix - email alerts:
Nothing in the message trace on the office 365 side. I'm adding a gmail address to also get emails to see what happens there.
Switch back to sending through the local host. Let's see what the log tells us. Don't make further changes until the logs are verified.
-
We got it working. Using localhost and port 25 was correct. The issue, the reason that that was not instantly obvious, is that there is a bug in the Zabbix interface and it shows people and addresses added to a trigger that are not really added. So no alerts were firing and attempting to send emails. We moved it to the localhost, and Mike got the triggers thing figured out and suddenly emails were flooding through.
-
The bug is if the user you are trying to send has the permission level of Zabbix Admin instead of a Zabbix Super Admin they don't really get added to the Zabbix Admins group or something like that. It doesn't make sense. I read this article:
https://www.zabbix.com/forum/showthread.php?p=126105#post126105
and then changed the user account that was supposed to get the emails to a Super Zabbix Admin and the messages started pouring in.
-
@Mike-Davis that's a huge pain! Why haven't they fixed that already?
-
Might give this a try when I re-build Zabbix in April/May
-
I realize this topic is aging out, but can we get a screen shot of what the localhost config should look like in Zabbix to get it all buttoned up?
I'm stuggling with the same issues, but I don't have info on what to put in all the other fields to make this work using the local postfix server.
I don't want to create a whole seperate email just to set up email alerts if postfix is already running.
Thanks
-
@cronsloth Do you mean the config page under Administration -> Media Types -> email?
-
@mike-davis said in Zabbix - email alerts:
under Administration -> Media Types -> email
that's the one! Email alerts aren't working for me either, and I found this thread.. Unfortunately haven't been able to get it going yet, nothing shows in the logs /var/log/maillog yet either, so it is probably something easy I am missing.
Happy to start a new thread if needs be
-
@cronsloth said in Zabbix - email alerts:
@mike-davis said in Zabbix - email alerts:
under Administration -> Media Types -> email
that's the one! Email alerts aren't working for me either, and I found this thread.. Unfortunately haven't been able to get it going yet, nothing shows in the logs /var/log/maillog yet either, so it is probably something easy I am missing.
Happy to start a new thread if needs be
Does the mail command work on its own?
-
yes the mail command by itself works fine and shows up in logs.
[root@zabbixv3 ~]# echo "test message" | mail -s "test email for postfix" [email protected]
[root@zabbixv3 ~]# cat /var/log/maillogOct 5 12:56:58 zabbixv3 postfix/qmgr[1292]: 446341013197: from=[email protected], size=475, nrcpt=1 (queue active)
Oct 5 12:56:58 zabbixv3 postfix/smtp[14102]: connect to aspmx.l.google.com[2607:f8b0:400e:c01::1b]:25: Network is unreachable
Oct 5 12:56:59 zabbixv3 postfix/smtp[14102]: 446341013197: to=[email protected], relay=aspmx.l.google.com[74.125.28.26]:25, delay=1, delays=0.03/0.02/0.75/0.22, dsn=2.0.0, status=sent (250 2.0.0 OK 1507233418 k91si4311249pld.78 - gsmtp)
Oct 5 12:56:59 zabbixv3 postfix/qmgr[1292]: 446341013197: removed -
Network is unreachable?
-
i saw that too, but it sends after. maybe something to do with the domain IP being an ipv6 address? The next line it connects successfully using an ipv4 address. I definitely received an email from this test.
Further info: I did make sure that my user i'm logged in as and sending to are both 'super zabbix admins'
What settings should be populated in 'SMTP: helo' and 'SMTP: email' ?
I assume I don't have to use a real email address (like yahoo, gmail, o365, etc) for the smtp email (since the 'mail' command successfully sends as 'zabbixv3@localdomain' ).My Settings (with my domain swapped out for 'mydomain.tv')
**[email protected] isn't a real email outside of this configSMTP Server : localhost
SMTP Server Port: 25
SMTP helo: mydomain.tv
SMTP email: Zabbix-Alerts <[email protected]>
connection Security: None
Authentication: None