Init do projeto.

This commit is contained in:
William Grando 2025-06-09 10:07:51 -03:00
commit 8da46951c5
2 changed files with 99 additions and 0 deletions

89
docker-compose.yml Normal file
View File

@ -0,0 +1,89 @@
---
services:
zbx-postgres:
image: postgres:alpine
container_name: zbx-postgres
restart: unless-stopped
environment:
POSTGRES_DB: zabbix
POSTGRES_USER: zabbix
POSTGRES_PASSWORD: zabbix
volumes:
- /mnt/disk2/data/db:/var/lib/postgresql/data
networks:
- zbx-net
zbx-server:
image: zabbix/zabbix-server-pgsql:alpine-latest
container_name: zbx-server
restart: unless-stopped
user: root
environment:
DB_SERVER_HOST: zbx-postgres
POSTGRES_USER: zabbix
POSTGRES_PASSWORD: zabbix
ZBX_CACHESIZE: 8G
ZBX_STARTPOLLERS: 19
ZBX_HOSTNAME: "zbx-server"
ZBX_TIMEOUT: 10
volumes:
- "/mnt/disk2/data/alertscripts:/usr/lib/zabbix/alertscripts"
- "/mnt/disk2/data/externalscripts:/usr/lib/zabbix/externalscripts"
- "/mnt/disk2/data/modules:/var/lib/zabbix/modules"
- "/mnt/disk2/data/snmptraps:/var/lib/zabbix/snmptraps"
- "/mnt/disk2/data/mibs:/var/lib/zabbix/mibs"
- "/mnt/disk2/data/export:/var/lib/zabbix/export"
- "/etc/localtime:/etc/localtime:ro"
- "./zabbix-init.sh:/usr/local/bin/zabbix-entrypoint.sh"
depends_on:
- zbx-postgres
entrypoint: ["/usr/local/bin/zabbix-entrypoint.sh"]
command: ["docker-entrypoint.sh"]
networks:
- zbx-net
zbx-web:
image: zabbix/zabbix-web-nginx-pgsql:alpine-latest
container_name: zbx-web
restart: unless-stopped
environment:
DB_SERVER_HOST: zbx-postgres
POSTGRES_USER: zabbix
POSTGRES_PASSWORD: zabbix
ZBX_SERVER_HOST: zbx-server
ZBX_MEMORYLIMIT: 512M
ZBX_SERVER_NAME: Instant
PHP_TZ: "America/Sao_Paulo"
depends_on:
- zbx-server
ports:
- 14201:8080
networks:
- zbx-net
zbx-agent:
image: zabbix/zabbix-agent:alpine-latest
container_name: zbx-agent
restart: unless-stopped
user: root
environment:
- ZBX_SERVER_HOST=zbx-server,zbx-agent
- ZBX_SERVER=zbx-server
- ZBX_HOSTNAME=zbx-server
#- ZBX_DEBUGLEVEL=5
- ZBX_LISTENIP=0.0.0.0
volumes:
- "/mnt/disk2/data/agent:/etc/zabbix/zabbix_agentd.d"
- "/mnt/disk2/data/agentmodules:/var/lib/zabbix/modules"
- "/etc/localtime:/etc/localtime:ro"
depends_on:
- zbx-server
networks:
zbx-net:
aliases:
- zbx-agent
- zbx-agent-passive
- zbx-agent-ubuntu
networks:
zbx-net:

10
zabbix-init.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
echo "[INIT] Instalando mtr no container..."
apk update && apk add --no-cache mtr
echo "[INIT] Executando entrypoint original..."
# Usa exec sem su, preservando variáveis de ambiente como DB_SERVER_HOST
exec /usr/bin/docker-entrypoint.sh /usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf