Step-by-Step Guide: Build a Zabbix Monitoring System from Scratch
This article walks you through the complete process of setting up Zabbix on a Linux server—including preparing the environment, installing LAMP, configuring the Zabbix server and agent, creating databases, defining templates, items, triggers, graphs, and custom script alerts—to achieve real‑time network traffic monitoring and automated notifications.
Installation Preparation
Before installing Zabbix, disable SELinux, install required packages, and prepare the LAMP stack.
LAMP Environment Setup
Install Apache, MySQL, and PHP, start MySQL, enable it at boot, and set a root password (replace yourpassword with your own).
Install Zabbix Server
Download and install Zabbix server packages, then create the Zabbix database.
Create Zabbix Database
Import the initial schema and data into the newly created database.
Configure Zabbix
Edit the Zabbix configuration files, replacing yourpasswd with your database password, and adjust the timezone as needed.
Optional: Change Zabbix Login Password
Modify the default admin password if desired.
Start Services
Enable Zabbix server and Apache to start on boot, then start them.
Set the services to start automatically at boot.
Access the Zabbix web interface via http://hostname/zabbix; the default login is Admin/zabbix.
Install Zabbix Agent
Install the agent on monitored hosts, configure the server address, and start the agent.
Add Host to Zabbix Server
In the Zabbix UI, add the new host, assign a template, and enable monitoring.
Bind the appropriate template to the host.
After updating, the host appears in the Hosts list.
Open port 10050 in the firewall if the agent must be queried remotely.
Monitor Network Traffic
To monitor inbound/outbound traffic on interface em1 of host 192.168.8.5, create a template, items, triggers, and graphs.
Create a new template.
Add an application under Configuration → Templates → Create application.
Create monitoring items for inbound and outbound traffic (e.g., network traffic on em1).
Define triggers that fire when traffic exceeds a threshold (e.g., 1 MiB/s).
Create graphs to visualize the traffic data.
Bind the template to the host.
After these steps, the latest data and graphs are visible under Monitoring → Latest data and Monitoring → Graphs.
Custom Script Alerting
Configure Zabbix to send alerts via a custom script (e.g., a DingTalk webhook). Define a media type that points to /usr/lib/zabbix/alertscripts/dingding.py, which receives three parameters: recipient, subject, and message.
Implement dingding.py to log the parameters or forward them to a webhook, and set executable permissions.
Define Events and User Media
Create an event that triggers every hour, generating ten alerts at two‑minute intervals, and associate it with the DingTalk media type.
Link the media type to a user (e.g., Admin) via Administration → Users → Media.
After completing these configurations, Zabbix will monitor network traffic, generate alerts when thresholds are exceeded, and send notifications through the custom script.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
