Monitoring isn't optional. If you don't know your server is down before your users do, you've already failed.
Zabbix is the enterprise standard. It's powerful, it's free, and it's notoriously annoying to install manually. Dependencies, PHP versions, database schemas… it's a mess.
We are going to skip all that. We are going to deploy a full Zabbix 6.0 LTS stack in 30 seconds using Docker Compose.
The Stack
- Zabbix Server: The brain.
- Zabbix Web: The frontend (Nginx based).
- PostgreSQL: The database (better performance than MySQL for Zabbix).
- Zabbix Agent: To monitor the host itself.
The Configuration
Create docker-compose.yaml. Note the ZBX_ environment variables—this is how we configure the server without touching config files.
version: '3.5'
services:
zabbix-server:
image: zabbix/zabbix-server-pgsql:ubuntu-6.0-latest
ports:
- "10051:10051"
volumes:
- /etc/localtime:/etc/localtime:ro
links:
- postgres-server:postgresql
restart: always
environment:
- POSTGRES_USER=zabbix
- POSTGRES_PASSWORD=zabbix_password
- POSTGRES_DB=zabbix
zabbix-web-nginx-pgsql:
image: zabbix/zabbix-web-nginx-pgsql:ubuntu-6.0-latest
ports:
- "8080:8080"
volumes:
- /etc/localtime:/etc/localtime:ro
links:
- zabbix-server:zabbix-server
- postgres-server:postgresql
restart: always
environment:
- ZBX_SERVER_HOST=zabbix-server
- POSTGRES_USER=zabbix
- POSTGRES_PASSWORD=zabbix_password
- POSTGRES_DB=zabbix
- PHP_TZ=Europe/Moscow
postgres-server:
image: postgres:13-alpine
volumes:
- ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=zabbix
- POSTGRES_PASSWORD=zabbix_password
- POSTGRES_DB=zabbix
restart: always
zabbix-agent:
image: zabbix/zabbix-agent:ubuntu-6.0-latest
ports:
- "10050:10050"
volumes:
- /etc/localtime:/etc/localtime:ro
links:
- zabbix-server:zabbix-server
restart: always
environment:
- ZBX_HOSTNAME=Zabbix Server
- ZBX_SERVER_HOST=zabbix-server
Deployment
- Run it:
docker-compose up -d - Wait 30 seconds for the database to initialize.
- Go to
http://localhost:8080. - Login with
Admin/zabbix.
Next Steps
You now have a monitoring server. Don't just stare at it. Add your first host, set up an email alert, and sleep better at night.