docker.recipes

Zabbix Enterprise Monitoring

intermediate

Complete Zabbix stack with server, web, agent, and PostgreSQL backend.

Overview

Zabbix Server is an open-source enterprise-class network monitoring solution that has been providing comprehensive infrastructure monitoring capabilities for over two decades. Originally developed by Alexei Vladishev in 2001, Zabbix excels at monitoring network services, servers, virtual machines, cloud resources, applications, and IoT devices through multiple collection methods including SNMP, IPMI, JMX, and custom agents. The platform stands out for its ability to handle millions of metrics while providing real-time visualization, flexible alerting, and automated discovery of network resources. This complete monitoring stack combines Zabbix Server with PostgreSQL as the backend database, delivering enterprise-grade performance and reliability. PostgreSQL's advanced indexing capabilities and ACID compliance make it ideal for storing the massive amounts of time-series data that Zabbix generates, while its JSON support enables flexible metadata storage for monitored items. The integrated NGINX web server provides high-performance delivery of the Zabbix web interface, handling concurrent user sessions efficiently while serving dashboards, graphs, and configuration screens. Organizations requiring comprehensive infrastructure visibility will find this stack particularly valuable for its scalability and depth of monitoring capabilities. Unlike simple uptime monitors or basic metrics collectors, this Zabbix deployment can handle complex monitoring scenarios including network topology mapping, predictive analytics through trend functions, and sophisticated alerting workflows with escalation chains and maintenance windows.

Key Features

  • Real-time monitoring with sub-second item collection intervals and immediate problem detection
  • Advanced trigger expressions supporting statistical functions, trend analysis, and predictive forecasting
  • Auto-discovery rules for automatic detection of network devices, file systems, and database instances
  • Template-based monitoring with inheritance and macro support for scalable configuration management
  • Native SNMP v1/v2c/v3 support for monitoring network equipment from all major vendors
  • Low-level discovery (LLD) for automatic creation of items, triggers, and graphs for dynamic resources
  • Distributed monitoring with proxy servers for remote location monitoring and reduced network overhead
  • Flexible alerting with media types including email, SMS, webhooks, and custom script execution

Common Use Cases

  • 1Enterprise data center monitoring with thousands of servers, network devices, and applications
  • 2Multi-tenant service provider infrastructure monitoring with customer-specific dashboards and SLAs
  • 3DevOps teams monitoring containerized applications and microservices architectures
  • 4Network operations centers (NOCs) requiring 24/7 infrastructure visibility and incident response
  • 5Compliance monitoring for industries requiring audit trails and availability reporting
  • 6IoT device monitoring in manufacturing, smart city, or industrial automation environments
  • 7Cloud hybrid monitoring combining on-premises infrastructure with AWS, Azure, or GCP resources

Prerequisites

  • Minimum 4GB RAM recommended for small environments (up to 1000 monitored items)
  • Docker Engine 20.10+ and Docker Compose v2 for container orchestration support
  • Available ports 8080, 8443, and 10051 for web interface and server communication
  • Basic understanding of SNMP, network protocols, and monitoring concepts
  • PostgreSQL administration knowledge for database maintenance and performance tuning
  • Familiarity with Zabbix template system and trigger expression syntax

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:15-alpine
4 environment:
5 - POSTGRES_USER=zabbix
6 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
7 - POSTGRES_DB=zabbix
8 volumes:
9 - postgres_data:/var/lib/postgresql/data
10 networks:
11 - zabbix_net
12
13 zabbix-server:
14 image: zabbix/zabbix-server-pgsql:latest
15 environment:
16 - DB_SERVER_HOST=postgres
17 - POSTGRES_USER=zabbix
18 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
19 - POSTGRES_DB=zabbix
20 ports:
21 - "10051:10051"
22 volumes:
23 - zabbix_data:/var/lib/zabbix
24 depends_on:
25 - postgres
26 networks:
27 - zabbix_net
28
29 zabbix-web:
30 image: zabbix/zabbix-web-nginx-pgsql:latest
31 environment:
32 - ZBX_SERVER_HOST=zabbix-server
33 - DB_SERVER_HOST=postgres
34 - POSTGRES_USER=zabbix
35 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
36 - POSTGRES_DB=zabbix
37 - PHP_TZ=UTC
38 ports:
39 - "8080:8080"
40 - "8443:8443"
41 depends_on:
42 - zabbix-server
43 networks:
44 - zabbix_net
45
46 zabbix-agent:
47 image: zabbix/zabbix-agent:latest
48 environment:
49 - ZBX_SERVER_HOST=zabbix-server
50 - ZBX_HOSTNAME=zabbix-agent
51 privileged: true
52 pid: host
53 depends_on:
54 - zabbix-server
55 networks:
56 - zabbix_net
57
58 zabbix-agent2:
59 image: zabbix/zabbix-agent2:latest
60 environment:
61 - ZBX_SERVER_HOST=zabbix-server
62 - ZBX_HOSTNAME=zabbix-agent2
63 volumes:
64 - /var/run/docker.sock:/var/run/docker.sock:ro
65 depends_on:
66 - zabbix-server
67 networks:
68 - zabbix_net
69
70volumes:
71 postgres_data:
72 zabbix_data:
73
74networks:
75 zabbix_net:

.env Template

.env
1# Zabbix Monitoring
2POSTGRES_PASSWORD=secure_postgres_password
3
4# Zabbix Web at http://localhost:8080
5# Default: Admin/zabbix

Usage Notes

  1. 1Web UI at http://localhost:8080
  2. 2Default credentials: Admin/zabbix
  3. 3Agent2 supports Docker monitoring
  4. 4SNMP and IPMI monitoring
  5. 5Template-based configuration

Individual Services(5 services)

Copy individual services to mix and match with your existing compose files.

postgres
postgres:
  image: postgres:15-alpine
  environment:
    - POSTGRES_USER=zabbix
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    - POSTGRES_DB=zabbix
  volumes:
    - postgres_data:/var/lib/postgresql/data
  networks:
    - zabbix_net
zabbix-server
zabbix-server:
  image: zabbix/zabbix-server-pgsql:latest
  environment:
    - DB_SERVER_HOST=postgres
    - POSTGRES_USER=zabbix
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    - POSTGRES_DB=zabbix
  ports:
    - "10051:10051"
  volumes:
    - zabbix_data:/var/lib/zabbix
  depends_on:
    - postgres
  networks:
    - zabbix_net
zabbix-web
zabbix-web:
  image: zabbix/zabbix-web-nginx-pgsql:latest
  environment:
    - ZBX_SERVER_HOST=zabbix-server
    - DB_SERVER_HOST=postgres
    - POSTGRES_USER=zabbix
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    - POSTGRES_DB=zabbix
    - PHP_TZ=UTC
  ports:
    - "8080:8080"
    - "8443:8443"
  depends_on:
    - zabbix-server
  networks:
    - zabbix_net
zabbix-agent
zabbix-agent:
  image: zabbix/zabbix-agent:latest
  environment:
    - ZBX_SERVER_HOST=zabbix-server
    - ZBX_HOSTNAME=zabbix-agent
  privileged: true
  pid: host
  depends_on:
    - zabbix-server
  networks:
    - zabbix_net
zabbix-agent2
zabbix-agent2:
  image: zabbix/zabbix-agent2:latest
  environment:
    - ZBX_SERVER_HOST=zabbix-server
    - ZBX_HOSTNAME=zabbix-agent2
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock:ro
  depends_on:
    - zabbix-server
  networks:
    - zabbix_net

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 postgres:
5 image: postgres:15-alpine
6 environment:
7 - POSTGRES_USER=zabbix
8 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
9 - POSTGRES_DB=zabbix
10 volumes:
11 - postgres_data:/var/lib/postgresql/data
12 networks:
13 - zabbix_net
14
15 zabbix-server:
16 image: zabbix/zabbix-server-pgsql:latest
17 environment:
18 - DB_SERVER_HOST=postgres
19 - POSTGRES_USER=zabbix
20 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
21 - POSTGRES_DB=zabbix
22 ports:
23 - "10051:10051"
24 volumes:
25 - zabbix_data:/var/lib/zabbix
26 depends_on:
27 - postgres
28 networks:
29 - zabbix_net
30
31 zabbix-web:
32 image: zabbix/zabbix-web-nginx-pgsql:latest
33 environment:
34 - ZBX_SERVER_HOST=zabbix-server
35 - DB_SERVER_HOST=postgres
36 - POSTGRES_USER=zabbix
37 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
38 - POSTGRES_DB=zabbix
39 - PHP_TZ=UTC
40 ports:
41 - "8080:8080"
42 - "8443:8443"
43 depends_on:
44 - zabbix-server
45 networks:
46 - zabbix_net
47
48 zabbix-agent:
49 image: zabbix/zabbix-agent:latest
50 environment:
51 - ZBX_SERVER_HOST=zabbix-server
52 - ZBX_HOSTNAME=zabbix-agent
53 privileged: true
54 pid: host
55 depends_on:
56 - zabbix-server
57 networks:
58 - zabbix_net
59
60 zabbix-agent2:
61 image: zabbix/zabbix-agent2:latest
62 environment:
63 - ZBX_SERVER_HOST=zabbix-server
64 - ZBX_HOSTNAME=zabbix-agent2
65 volumes:
66 - /var/run/docker.sock:/var/run/docker.sock:ro
67 depends_on:
68 - zabbix-server
69 networks:
70 - zabbix_net
71
72volumes:
73 postgres_data:
74 zabbix_data:
75
76networks:
77 zabbix_net:
78EOF
79
80# 2. Create the .env file
81cat > .env << 'EOF'
82# Zabbix Monitoring
83POSTGRES_PASSWORD=secure_postgres_password
84
85# Zabbix Web at http://localhost:8080
86# Default: Admin/zabbix
87EOF
88
89# 3. Start the services
90docker compose up -d
91
92# 4. View logs
93docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/zabbix-complete/run | bash

Troubleshooting

  • Zabbix server cannot connect to database: Verify POSTGRES_PASSWORD environment variable matches across all services and check postgres container logs for authentication errors
  • Web interface shows 'Zabbix server is not running': Ensure zabbix-server container started successfully and check port 10051 connectivity between web and server containers
  • Items showing 'Timeout while connecting to Zabbix Agent': Configure host firewall rules to allow connections from zabbix-server container IP range on port 10050
  • High database CPU usage with slow queries: Implement PostgreSQL query optimization by creating indexes on history and trends tables, consider partitioning for large datasets
  • Agent auto-registration failing: Verify ZBX_SERVER_HOST environment variable in agent containers points to correct zabbix-server service name and check network connectivity
  • SNMP monitoring not working: Confirm SNMP community strings or v3 credentials are correct and target devices have SNMP enabled with proper access control lists

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

Ad Space