Introduction
Zabbix is an open source monitoring and alerting solution that supervises servers, networks, and applications in real time. In 2026, with the growing complexity of hybrid infrastructures, mastering Zabbix is essential to anticipate failures and optimize performance. This intermediate tutorial guides you through a professional Docker deployment, agent configuration, and custom template creation. You will learn to collect precise metrics while avoiding common overload pitfalls. Each step includes concrete, functional examples for immediate implementation.
Prerequisites
- Linux server (Ubuntu 22.04 or Debian 12)
- Docker and Docker Compose installed
- Root or sudo access
- Basic knowledge of YAML and command line
- PostgreSQL database (optional for production)
Installation via Docker Compose
version: '3.8'
services:
zabbix-server:
image: zabbix/zabbix-server-pgsql:6.4-latest
ports:
- "10051:10051"
environment:
- DB_SERVER_HOST=zabbix-db
- POSTGRES_USER=zabbix
- POSTGRES_PASSWORD=StrongPass2026
depends_on:
- zabbix-db
zabbix-web:
image: zabbix/zabbix-web-nginx-pgsql:6.4-latest
ports:
- "8080:8080"
environment:
- ZBX_SERVER_HOST=zabbix-server
- DB_SERVER_HOST=zabbix-db
zabbix-db:
image: postgres:15
environment:
- POSTGRES_USER=zabbix
- POSTGRES_PASSWORD=StrongPass2026
- POSTGRES_DB=zabbixThis docker-compose file deploys Zabbix Server, the web interface, and PostgreSQL. The environment variables ensure a secure connection between the services.
Starting the Container
docker compose up -d
# Wait 60 seconds for initialization
sleep 60
# Check the logs
docker compose logs -f zabbix-serverThis command starts the services in the background. The delay allows the database to initialize before the Zabbix server attempts to connect.
Zabbix Agent Configuration
Server=192.168.1.100
ServerActive=192.168.1.100
Hostname=web-server-01
ListenPort=10050
StartAgents=3
RefreshActiveChecks=60
BufferSend=5
BufferSize=100This file configures the agent to communicate with the Zabbix server. The BufferSend and BufferSize parameters optimize metric transmission in case of network latency.
Installing the Agent on a Host
#!/bin/bash
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
sudo apt install zabbix-agent
sudo cp zabbix_agentd.conf /etc/zabbix/
sudo systemctl enable --now zabbix-agentThis script installs and configures the Zabbix agent on an Ubuntu server. It enables the service for automatic startup after each reboot.
Custom Template in JSON
{
"zabbix_export": {
"version": "6.4",
"templates": [{
"template": "Custom Linux Metrics",
"groups": [{"name": "Templates"}],
"items": [{
"name": "CPU Load 5min",
"key": "system.cpu.load[all,avg5]",
"type": 0,
"value_type": 0
}]
}]
}
}This JSON file defines a template with a CPU item. Import it via the web interface to quickly reuse configurations across multiple hosts.
Best Practices
- Always use official templates before creating custom items
- Configure triggers with thresholds suited to your environment
- Enable TLS encryption between agents and server
- Limit user permissions using RBAC roles
- Monitor database size with hourly partitions
Common Errors to Avoid
- Forgetting to open port 10051 on the server firewall
- Using weak passwords for the PostgreSQL database
- Not enabling active checks on remote agents
- Ignoring minor updates that fix memory leaks
Going Further
Explore the Zabbix API to automate host creation and discover our Learni training courses on advanced monitoring.