Part 3 will focus on turning Zabbix from a monitoring dashboard into an active alerting system.
So far, we have successfully connected our monitored server to Zabbix. The Zabbix server can now collect metrics from our agent, such as CPU usage, memory utilization, disk space, and system information.
However, monitoring data alone is not enough.
Imagine a production server running out of disk space. Zabbix can collect the disk usage percentage every minute, but unless someone checks the dashboard manually, nobody knows there is a problem.
This is where triggers, alerts, and notifications come in.
A complete monitoring workflow looks like this:
Metric Collection
|
|
v
Zabbix Items
|
|
v
Triggers
|
|
v
Problem Detection
|
|
v
Notifications
|
|
v
Administrator Action
Understanding Zabbix Items
Before creating triggers, we need to understand items.
An item is a metric that Zabbix collects from a monitored host.
Examples:
Item ------> Purpose
CPU utilization------> Monitor processor usage
Memory utilization-----> Monitor RAM usage
Disk space-----> Monitor storage capacity
Network traffic -----> Monitor bandwidth
System uptime------> Monitor availability
example:
Host:
rhcsa
Item:
CPU utilization
Value:
35%
Creating a Trigger
A trigger defines when a normal metric becomes a problem.
Think of it like this:
Item:
CPU usage = 95%
Trigger:
If CPU usage is above 90% for 5 minutes,
create a problem.
The trigger is the logic that converts data into an event.
*Create a CPU Trigger
*
Go to:
Monitoring
|
Host
|
specific Hosts(rhcsa)
|
Triggers
|
Create trigger
Fill in:
Name:
High CPU Usage on {HOST.NAME} in this case ours is {rhcsa}
Severity:
Warning
Expression:
Click:
Add
Select:
Item:
CPU utilization
Condition:
Last value > 20
Example expression:
last(/rhcsa/system.cpu.util)>90
Click:
Add
Now Zabbix will monitor CPU usage.

last(/rhcsa/system.cpu.util,#20)>20 isnt the same last(/rhcsa/system.cpu.util)>20 do take note as the latter
Take the most recent value of system.cpu.util and check if it is greater than 20.
on the rhcsa where the agent is we would trigger a high cpu usage using:
yes > /dev/null
or in the zabbix server :
zabbix_get -s 192.168.120.130(ip of the agent) -k system.cpu.util
43.189230
Creating Dashboards
Dashboards provide a visual overview of your infrastructure.
zabbix 7.0 already provides a nice visual dashboard all we need to do is edit as we see fit, such as editing and showing us which host/server/system is using the most cpu and adding more host to view
and change the parameters we see as well
I had edited what i wish to see which is all the host/system/server, their cpu usage, memory not in use and how many user are logged in, feel free to play around as long it not a live or a production server. :D
Configuring Notifications
A trigger detects a problem.
A notification tells someone about it.
The flow:
Trigger
|
|
v
Action
|
|
v
Media Type
|
|
v
Email / Slack / Teams / SMS
in order to achieve this we must create a user or users that will be assigned to receive such triggers:
Go to:
alert-->media
`Go to:
Media
Add:
Type:
Example:
Configure Zabbix Email Alert Notifications (Complete Step-by-Step Guide)
After creating triggers in Zabbix, the next step is to configure alert actions so that Zabbix can automatically notify administrators when a problem occurs.
In this guide, we will configure Zabbix to send an email notification when CPU usage becomes high.
The process involves:
- Creating the trigger
- Creating an email media type
- Configuring Gmail SMTP
- Creating a Google App Password
- Assigning the media to a Zabbix user
- Creating an alert action
- Testing the notification
Step 1: Create an Email Media Type
First, we need to tell Zabbix how it should send emails.
Navigate to:
Alerts
|
Media types
Click:
Create media type
Configure the following:
Name
trigger or problem
Type
Email
Email provider
Select:
Generic SMTP
Configure the SMTP settings:
SMTP server:
smtp.gmail.com
SMTP server port:
465
For Gmail, use SSL/TLS:
Connection security:
SSL/TLS
Do not use port 587 with STARTTLS if your network blocks it.
Step 2: Configure Gmail Authentication
At first, we tried sending email without authentication, but Gmail rejected the request.
The error received was:
530 Authentication required
Gmail does not allow applications to send email using only the email address.
You must use a Google App Password.
Step 3: Create a Google App Password
Open your Google Account:
https://myaccount.google.com
Go to:
Security
Enable:
2-Step Verification
After enabling it, go back to:
Security
Find:
App passwords
Create a new app password.
Select:
Other (Custom name)
Enter:
Zabbix
Google will generate a 16-character password.
Example:
xxxx xxxx xxxx xxxx
Copy this password.
Important:
Do not use your normal Gmail password.
The Google App Password is the password Zabbix uses to authenticate with Gmail SMTP.
Step 4: Complete the Zabbix Email Configuration
Return to:
Alerts
|
Media types
|
trigger or problem
Configure:
morodoluoluwafikunayomo@gmail.com
Authentication
Change:
None
to:
Username and password
Enter:
Username:
morodoluoluwafikunayomo@gmail.com
Password:
Google App Password generated earlier
Step 5: Add Message Templates
Without a message template, Zabbix will create the alert but fail to send it.
The error will look like:
No message defined for media type
Go to:
Alerts
|
Media types
|
trigger or problem
|
Message templates
Click:
Add
Create a Problem template.
Message type:
Problem
Template:
Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name:
{EVENT.NAME}
Host:
{HOST.NAME}
Severity:
{EVENT.SEVERITY}
Operational data:
{EVENT.OPDATA}
Event ID:
{EVENT.ID}
Save.
Step 6: Assign the Media Type to the Admin User
Creating a media type is not enough.
Zabbix users need to have a notification method assigned.
If this step is skipped, you will get:
No media defined for user
Go to:
Users
|
Admin
Open the:
Media
tab.
Click:
Add
Configure:
Type:
trigger or problem
Send to:
morodoluoluwafikunayomo@gmail.com
When active:
1-7,00:00-24:00
Select severities:
Warning
Average
High
Disaster
Save the user.
Step 7: Create the Alert Action
Now we tell Zabbix what to do when a problem occurs.
Navigate to:
Alerts
|
Actions
|
Trigger actions
Click:
Create action
Action Name
Enter:
Send CPU Alerts
Conditions
Click:
Add condition
Select:
Trigger severity
Set:
is greater than or equals
Choose:
High
The condition becomes:
Trigger severity >= High
This means only High and Disaster problems will send notifications.
Operations
Go to:
Operations
Click:
Add
Select:
Send message
Choose:
Send to users
Select:
Admin (Zabbix Administrator)
Select media type:
trigger or problem
Save the action.
Make sure the action status is:
Enabled
Step 8: Test the Alert
Generate a CPU problem on the monitored host:
Install stress if needed:
sudo apt install stress
Run:
stress --cpu 4 --timeout 300
Wait for the trigger to fire.
Check:
Alerts
|
Action log
A successful notification should show:
Status:
Sent
The email should arrive in your Gmail inbox.
Common Problems and Fixes
Problem 1: Host availability is red
Error:
Get value from agent failed
Check:
Agent configuration
Network connectivity
Port 10050
Problem 2: No media defined for user
Cause:
The media type exists but is not attached to the user.
Fix:
Users
|
Admin
|
Media
|
Add
Problem 3: No message defined for media type
Cause:
The media type has no message template.
Fix:
Add:
Problem
message template.
Problem 4: SMTP timeout
Example:
Failed to connect to smtp.gmail.com port 587
Cause:
Network blocking SMTP port 587.
Fix:
Use:
Port:
465
Security:
SSL/TLS
Problem 5: Gmail authentication error
Example:
530 Authentication required
Cause:
Using Gmail password instead of App Password.
Fix:
Create a Google App Password and use it in Zabbix.
After completing these steps, Zabbix can automatically detect problems and send email notifications without requiring manual checking.
















Top comments (0)