diff --git a/zabbix/.env b/zabbix/.env new file mode 100644 index 0000000..8cc7610 --- /dev/null +++ b/zabbix/.env @@ -0,0 +1,12 @@ +# Zabbix web frontend +WEB_PORT=81 +PHP_TZ=Europe/Amsterdam + +# Agent +AGENT_HOSTNAME=AgapHost + +# PostgreSQL +POSTGRES_DATA_DIR=/mnt/ssd/dbs/zabbix +POSTGRES_USER=zabbix +POSTGRES_PASSWORD=fefwG11UAFfs110 +POSTGRES_DB=zabbix diff --git a/zabbix/docker-compose.yml b/zabbix/docker-compose.yml new file mode 100644 index 0000000..e3187b6 --- /dev/null +++ b/zabbix/docker-compose.yml @@ -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