How to Configure Zabbix to Send Email Alerts to Gmail Account
Zabbix is a leading open-source monitoring tool that helps you track the health and performance of servers, networks, and applications. Real-time alerting is one of its most critical features, ensuring you can respond quickly to outages or degradations. While Zabbix supports multiple alert channels, email remains a reliable choice—especially when integrated with Google’s Gmail, which offers robust deliverability and spam protection.
Google’s strict security policies (which block "less secure apps") require a few extra steps to set up Zabbix with Gmail. In this comprehensive guide, we’ll walk you through every step: securing your Gmail account for Zabbix access, configuring Zabbix’s SMTP media type, setting up user alerts, and testing the entire workflow.
Click Add and select Trigger severity > equals > Critical. Add more conditions (e.g., exclude test hosts) if needed.
On the Operations tab:
Click New > Send message.
Select the user/group assigned to the Gmail media type and choose "Gmail SMTP Alert" as the media type.
On the Recovery operations tab:
Create a similar operation to send a recovery alert when the trigger returns to OK state (e.g., subject: [{TRIGGER.STATUS}] Zabbix Recovery: {TRIGGER.NAME}).
Navigate to Configuration > Hosts and select a monitored host.
Click Triggers > Create trigger.
Name it "Test Critical Trigger" and set the expression to {HOSTNAME:system.cpu.load[all,avg1].last()} > 0.1 (most servers have a load above this threshold).
Set severity to Critical and save.
Wait 5-10 minutes for Zabbix to detect the problem. Check your inbox for the alert.
Log Troubleshooting:
If alerts fail, check Zabbix server logs for errors:
sudo tail -f /var/log/zabbix/zabbix_server.log
Look for lines containing "SMTP" or "media type" to identify issues like authentication failures.
Fix: Confirm port 587 and STARTTLS are set. If using port 465, switch to SSL. Check if your server’s IP is blocked by Google (send a test email from another device to rule this out).
Configuring Zabbix to send alerts via Gmail is a straightforward process once you navigate Google’s security requirements. By enabling 2FA, generating an app password, and setting up the SMTP media type, you’ll ensure critical alerts reach your inbox in real time.
Remember to:
Keep your app password secure (treat it like any sensitive credential).
Test alerts regularly to catch configuration issues early.
Customize actions for different severities (e.g., send high-severity alerts to multiple teams).
With this setup, you’ll never miss an important notification about your monitored infrastructure.