Zabbix Monitoring Stack
Zabbix monitoring with PostgreSQL and web frontend.
Overview
Zabbix is an enterprise-class open-source monitoring solution that has been actively developed since 2001, designed to monitor networks, servers, virtual machines, and cloud services. It provides real-time monitoring, alerting, and visualization capabilities with support for thousands of devices and metrics, making it a comprehensive infrastructure monitoring platform used by organizations worldwide. This deployment creates a complete Zabbix monitoring environment using four interconnected containers: a PostgreSQL database for storing configuration and metrics data, the Zabbix server daemon for data collection and processing, a web frontend with embedded Nginx for the user interface, and a Zabbix agent for monitoring the Docker host itself. The stack uses PostgreSQL as the backend database, providing robust data integrity and performance for storing the extensive monitoring data that Zabbix collects. This configuration is ideal for system administrators and DevOps teams who need a professional-grade monitoring solution that can scale from small environments to enterprise infrastructures, offering both agentless and agent-based monitoring with flexible alerting mechanisms and comprehensive reporting capabilities.
Key Features
- Real-time monitoring with customizable data collection intervals from seconds to hours
- Multi-tier alerting system with escalation policies and multiple notification channels
- Template-based configuration system for rapid deployment of monitoring across similar hosts
- Network discovery capabilities for automatic detection and monitoring of network devices
- Built-in graphing engine with trend analysis and forecasting functions
- Low-level discovery rules for automatic monitoring of dynamic resources like filesystems and network interfaces
- Web-based administration interface with role-based access control and user management
- PostgreSQL backend providing ACID compliance and efficient storage of time-series monitoring data
Common Use Cases
- 1Enterprise infrastructure monitoring across physical, virtual, and cloud environments
- 2Network operations center (NOC) deployments requiring centralized monitoring dashboards
- 3DevOps teams implementing comprehensive observability for application and infrastructure stacks
- 4Managed service providers offering monitoring services to multiple clients with tenant isolation
- 5IT departments transitioning from legacy monitoring tools to a unified open-source solution
- 6Compliance-driven environments requiring detailed audit trails and performance documentation
- 7High-availability service monitoring with automatic failover detection and alerting
Prerequisites
- Docker and Docker Compose installed with at least 2GB available RAM for optimal performance
- Port 8080 available for web interface and port 10051 for Zabbix server communication
- Basic understanding of monitoring concepts like hosts, items, triggers, and templates
- Network access from monitored systems to the Zabbix server on port 10051
- Understanding of PostgreSQL basics for database maintenance and backup procedures
- Familiarity with SNMP, SSH, or agent-based monitoring depending on your target systems
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 postgres: 3 image: postgres:16-alpine4 container_name: zabbix-postgres5 restart: unless-stopped6 environment: 7 POSTGRES_USER: ${POSTGRES_USER:-zabbix}8 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-zabbix}9 POSTGRES_DB: ${POSTGRES_DB:-zabbix}10 volumes: 11 - postgres_data:/var/lib/postgresql/data12 networks: 13 - zabbix-network1415 zabbix-server: 16 image: zabbix/zabbix-server-pgsql:latest17 container_name: zabbix-server18 restart: unless-stopped19 ports: 20 - "10051:10051"21 environment: 22 - DB_SERVER_HOST=postgres23 - POSTGRES_USER=${POSTGRES_USER:-zabbix}24 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-zabbix}25 - POSTGRES_DB=${POSTGRES_DB:-zabbix}26 depends_on: 27 - postgres28 networks: 29 - zabbix-network3031 zabbix-web: 32 image: zabbix/zabbix-web-nginx-pgsql:latest33 container_name: zabbix-web34 restart: unless-stopped35 ports: 36 - "${WEB_PORT:-8080}:8080"37 environment: 38 - DB_SERVER_HOST=postgres39 - POSTGRES_USER=${POSTGRES_USER:-zabbix}40 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-zabbix}41 - POSTGRES_DB=${POSTGRES_DB:-zabbix}42 - ZBX_SERVER_HOST=zabbix-server43 - PHP_TZ=${TZ:-UTC}44 depends_on: 45 - postgres46 - zabbix-server47 networks: 48 - zabbix-network4950 zabbix-agent: 51 image: zabbix/zabbix-agent:latest52 container_name: zabbix-agent53 restart: unless-stopped54 environment: 55 - ZBX_SERVER_HOST=zabbix-server56 depends_on: 57 - zabbix-server58 networks: 59 - zabbix-network6061volumes: 62 postgres_data: 6364networks: 65 zabbix-network: 66 driver: bridge.env Template
.env
1# Zabbix2WEB_PORT=80803POSTGRES_USER=zabbix4POSTGRES_PASSWORD=zabbix5POSTGRES_DB=zabbix6TZ=UTCUsage Notes
- 1Zabbix at http://localhost:8080
- 2Default login: Admin/zabbix
- 3Change password on first login
- 4Deploy agents on monitored hosts
Individual Services(4 services)
Copy individual services to mix and match with your existing compose files.
postgres
postgres:
image: postgres:16-alpine
container_name: zabbix-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-zabbix}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-zabbix}
POSTGRES_DB: ${POSTGRES_DB:-zabbix}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- zabbix-network
zabbix-server
zabbix-server:
image: zabbix/zabbix-server-pgsql:latest
container_name: zabbix-server
restart: unless-stopped
ports:
- "10051:10051"
environment:
- DB_SERVER_HOST=postgres
- POSTGRES_USER=${POSTGRES_USER:-zabbix}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-zabbix}
- POSTGRES_DB=${POSTGRES_DB:-zabbix}
depends_on:
- postgres
networks:
- zabbix-network
zabbix-web
zabbix-web:
image: zabbix/zabbix-web-nginx-pgsql:latest
container_name: zabbix-web
restart: unless-stopped
ports:
- ${WEB_PORT:-8080}:8080
environment:
- DB_SERVER_HOST=postgres
- POSTGRES_USER=${POSTGRES_USER:-zabbix}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-zabbix}
- POSTGRES_DB=${POSTGRES_DB:-zabbix}
- ZBX_SERVER_HOST=zabbix-server
- PHP_TZ=${TZ:-UTC}
depends_on:
- postgres
- zabbix-server
networks:
- zabbix-network
zabbix-agent
zabbix-agent:
image: zabbix/zabbix-agent:latest
container_name: zabbix-agent
restart: unless-stopped
environment:
- ZBX_SERVER_HOST=zabbix-server
depends_on:
- zabbix-server
networks:
- zabbix-network
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 postgres:5 image: postgres:16-alpine6 container_name: zabbix-postgres7 restart: unless-stopped8 environment:9 POSTGRES_USER: ${POSTGRES_USER:-zabbix}10 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-zabbix}11 POSTGRES_DB: ${POSTGRES_DB:-zabbix}12 volumes:13 - postgres_data:/var/lib/postgresql/data14 networks:15 - zabbix-network1617 zabbix-server:18 image: zabbix/zabbix-server-pgsql:latest19 container_name: zabbix-server20 restart: unless-stopped21 ports:22 - "10051:10051"23 environment:24 - DB_SERVER_HOST=postgres25 - POSTGRES_USER=${POSTGRES_USER:-zabbix}26 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-zabbix}27 - POSTGRES_DB=${POSTGRES_DB:-zabbix}28 depends_on:29 - postgres30 networks:31 - zabbix-network3233 zabbix-web:34 image: zabbix/zabbix-web-nginx-pgsql:latest35 container_name: zabbix-web36 restart: unless-stopped37 ports:38 - "${WEB_PORT:-8080}:8080"39 environment:40 - DB_SERVER_HOST=postgres41 - POSTGRES_USER=${POSTGRES_USER:-zabbix}42 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-zabbix}43 - POSTGRES_DB=${POSTGRES_DB:-zabbix}44 - ZBX_SERVER_HOST=zabbix-server45 - PHP_TZ=${TZ:-UTC}46 depends_on:47 - postgres48 - zabbix-server49 networks:50 - zabbix-network5152 zabbix-agent:53 image: zabbix/zabbix-agent:latest54 container_name: zabbix-agent55 restart: unless-stopped56 environment:57 - ZBX_SERVER_HOST=zabbix-server58 depends_on:59 - zabbix-server60 networks:61 - zabbix-network6263volumes:64 postgres_data:6566networks:67 zabbix-network:68 driver: bridge69EOF7071# 2. Create the .env file72cat > .env << 'EOF'73# Zabbix74WEB_PORT=808075POSTGRES_USER=zabbix76POSTGRES_PASSWORD=zabbix77POSTGRES_DB=zabbix78TZ=UTC79EOF8081# 3. Start the services82docker compose up -d8384# 4. View logs85docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/zabbix-monitoring/run | bashTroubleshooting
- Zabbix server container fails to start: Check PostgreSQL container is healthy and database credentials match between postgres and zabbix-server services
- Web interface shows database connection errors: Verify POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB environment variables are consistent across zabbix-web and postgres services
- Cannot access web interface at localhost:8080: Ensure WEB_PORT environment variable is set correctly and no other service is using the configured port
- Zabbix agent not appearing in web interface: Check that zabbix-agent container can resolve zabbix-server hostname and verify ZBX_SERVER_HOST environment variable
- High memory usage in postgres container: Monitor postgres_data volume size and implement data housekeeping policies in Zabbix administration settings
- Zabbix server reports database connection timeouts: Increase PostgreSQL max_connections setting and ensure adequate resources are allocated to postgres container
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
zabbix-serverzabbix-webzabbix-agentpostgresql
Tags
#zabbix#monitoring#alerting#infrastructure#postgresql
Category
Monitoring & ObservabilityAd Space
Shortcuts: C CopyF FavoriteD Download