Add Zabbix Docker Compose config, fix agent hostname

Set AGENT_HOSTNAME=AgapHost to match the existing host in Zabbix server
(was agap-server, causing "host not found" errors).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alvis
2026-02-22 10:40:10 +00:00
parent 0848b6f3fb
commit 7548ba117f
2 changed files with 111 additions and 0 deletions

99
zabbix/docker-compose.yml Normal file
View File

@@ -0,0 +1,99 @@
services:
postgres-server:
image: postgres:16-alpine
restart: unless-stopped
volumes:
- ${POSTGRES_DATA_DIR}:/var/lib/postgresql/data
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
networks:
- database
stop_grace_period: 1m
zabbix-server:
image: zabbix/zabbix-server-pgsql:ubuntu-7.4-latest
restart: unless-stopped
ports:
- "10051:10051"
environment:
DB_SERVER_HOST: postgres-server
DB_SERVER_PORT: 5432
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- /etc/localtime:/etc/localtime:ro
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
depends_on:
- postgres-server
networks:
- database
- backend
- frontend
stop_grace_period: 30s
zabbix-web:
image: zabbix/zabbix-web-apache-pgsql:ubuntu-7.4-latest
restart: unless-stopped
ports:
- "${WEB_PORT}:8080"
environment:
ZBX_SERVER_HOST: zabbix-server
ZBX_SERVER_PORT: 10051
DB_SERVER_HOST: postgres-server
DB_SERVER_PORT: 5432
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
PHP_TZ: ${PHP_TZ}
volumes:
- /etc/localtime:/etc/localtime:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/ping"]
interval: 1m30s
timeout: 3s
retries: 3
start_period: 40s
start_interval: 5s
depends_on:
- postgres-server
- zabbix-server
networks:
- database
- backend
- frontend
stop_grace_period: 10s
zabbix-agent:
image: zabbix/zabbix-agent:ubuntu-7.4-latest
restart: unless-stopped
environment:
ZBX_HOSTNAME: ${AGENT_HOSTNAME}
ZBX_SERVER_HOST: zabbix-server
ZBX_SERVER_ACTIVE: zabbix-server
ZBX_STARTAGENTS: "0"
volumes:
- /etc/localtime:/etc/localtime:ro
privileged: true
pid: host
depends_on:
- zabbix-server
networks:
- backend
stop_grace_period: 5s
networks:
frontend:
driver: bridge
backend:
driver: bridge
internal: true
database:
driver: bridge
internal: true