Comprehensive Zabbix Monitoring Setup for Linux Servers: Alerts, Dashboards, and Automation

Zabbix is a powerful open-source monitoring solution for networks, servers, applications, and cloud infrastructure. Properly implemented, it allows real-time monitoring, alerting, trending analysis, and automation.

This guide provides a step-by-step setup for Linux servers, including:

It’s ideal for DevOps, system administrators, and IT operations teams.


Real-Life Scenario

Scenario:

Solution: Deploy Zabbix server + agents, configure templates, and enable alerting.


Step 1: Prerequisites


Step 2: Install Zabbix Server on Ubuntu 22.04

  1. Import Zabbix repository:

wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo apt update
  1. Install Zabbix server, web frontend, and agent:

sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent -y
  1. Create MySQL database for Zabbix:

sudo mysql -u root -p
CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'StrongPassword!';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;
  1. Import initial schema:

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
  1. Configure Zabbix server:

Edit /etc/zabbix/zabbix_server.conf:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=StrongPassword!
  1. Start services:

sudo systemctl enable zabbix-server zabbix-agent apache2
sudo systemctl start zabbix-server zabbix-agent apache2

Step 3: Configure Zabbix Frontend

  1. Open browser: http://your-server-ip/zabbix

  2. Follow installation wizard:


Step 4: Install Zabbix Agent on Client Servers

For Ubuntu:

sudo apt install zabbix-agent -y
sudo systemctl enable zabbix-agent
sudo systemctl start zabbix-agent

For CentOS/AlmaLinux:

sudo dnf install zabbix-agent -y
sudo systemctl enable zabbix-agent
sudo systemctl start zabbix-agent

Verify connectivity:

telnet zabbix-server-ip 10050

Step 5: Add Hosts to Zabbix Server

  1. Navigate to Configuration → Hosts → Create Host

  2. Enter:

  1. Save configuration


Step 6: Monitor Key Metrics

Default Zabbix templates monitor:

Add custom items:

zabbix_get -s client-server-ip -k mysql.ping
vfs.dev.read[/,bytes]

Step 7: Configure Alerts and Actions

  1. Go to Configuration → Actions

  2. Create a new action:

Slack integration example:

curl -X POST -H 'Content-type: application/json' --data '{"text":"High CPU Alert on Server1"}' https://hooks.slack.com/services/XXXX/XXXX/XXXX

Step 8: Create Dashboards

  1. Go to Monitoring → Dashboards → Create Dashboard

  2. Add widgets:

Benefit: Visualize health of all servers at a glance.


Step 9: Real-Life Example

Scenario: Production web server experiencing high load


Step 10: Best Practices


Benefits


💡 Pro Tip: Combine Zabbix with Prometheus exporters for hybrid cloud monitoring, and integrate Grafana dashboards for advanced visualization.