Simplified Docker Compose configuration for running Zabbix monitoring system with Grafana dashboards
For those who are used to using zabbix to collect metrics, but want to start drawing dashboards more beautifully
Example simple docker-compose service
Current versions:
- Zabbix Server: 7.4
- PostgreSQL: 17-alpine
- Grafana: 12.1.0
git clone https://github.com/akmalovaa/zabbix-docker.git
cd zabbix-docker
Review and modify the .env
file if needed:
cp .env .env.local # Optional: create local copy
nano .env # Edit configuration
docker compose up -d
⏱️ First launch takes 1-2 minutes while PostgreSQL initializes and Zabbix server starts.
Check if all services are running:
docker compose ps
Key variables in .env
file:
Variable | Default | Description |
---|---|---|
POSTGRES_USER |
zabbix |
PostgreSQL username |
POSTGRES_PASSWORD |
zabbix |
PostgreSQL password |
POSTGRES_DB |
zabbix |
Database name |
GF_SECURITY_ADMIN_USER |
admin |
Grafana admin username |
GF_SECURITY_ADMIN_PASSWORD |
12345 |
Grafana admin password |
TZ |
Asia/Yekaterinburg |
Timezone for all services |
⚠️ Security Note: Change default passwords in production!
Service | Internal Port | External Port | URL |
---|---|---|---|
Zabbix Frontend | 8080 | 8080 | YOUR_HOST:8080 |
Grafana | 3000 | 3000 | YOUR_HOST:3000 |
Zabbix Agent | 10050 | 10050 | (used internally) |
Zabbix Server | 10051 | 10051 | (used internally) |
PostgreSQL | 5432 | - | Default Internal only |
URL: localhost:8080
Default Credentials:
- Username:
Admin
- Password:
zabbix
- Navigate to Configuration → Hosts
- Click on Zabbix server host
- Go to Interfaces tab
- Change Connect to from IP to DNS
- Set DNS name to
zabbix-agent
- Update the host
URL: localhost:3000
Default Credentials:
- Username:
admin
- Password:
12345
💡 Anonymous access is enabled by default (see
grafana/grafana.ini
)
- Go to Connections → Data sources
- Select Zabbix data source
- Click Test button
- Should show "Data source is working"
# All services
docker compose logs --tail=10 -f
# Specific service
docker compose logs -f zabbix-server
docker compose logs -f postgres
# Check database connection
docker compose logs zabbix-server
# Restart services in order
docker compose restart postgres
sleep 30
docker compose restart zabbix-server
# Check if ports are available
netstat -tulpn | grep -E ':(8080|3000|10051|10050)'
# Check container status
docker compose ps
# Verify Zabbix API is accessible
curl -X POST http://localhost:8080/api_jsonrpc.php \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"apiinfo.version","id":1}'
For better performance with large datasets:
# Add to zabbix-server environment in compose.yaml
ZBX_CACHESIZE: "128M"
ZBX_CACHEUPDATEFREQUENCY: "60"
ZBX_STARTDBSYNCERS: "4"
- Change default passwords in
.env
- Use strong database passwords
- Restrict access to ports (use firewall/security groups)
- Enable HTTPS for Zabbix frontend
- Configure proper backup strategy