Zabbix Notification: PostgreSQL database "zabbix" on "postgres:5432" is not available: could not translate host name "postgres" to address: Name does not resolve
Otherwise - the Zabbix server, the auto-registration, the templates, the active and passive elements, the triggers, the notifications, the graphical user interface - everything works fine.
The VM size at Hetzner Cloud is comfortable (ccx13) for what we do with Zabbix (~20 Linux servers, some network devices).
- Docker 24.0.5 (Ubuntu 22.4.3)
- Zabbix 6.4
- Postgres 14
The docker-compose.yml is based on the official example.
We run almost all of our services with Docker. The Zabbix setup is the first setup that has this error.
Does anyone have any idea what can cause this error?
PHP Code:
services:
postgres:
hostname: postgres
restart: always
image: postgres:14-alpine
volumes:
- postgres:/var/lib/postgresql/data
env_file:
- ./env_vars/.env_pgsql
secrets:
- POSTGRES_USER
- POSTGRES_PASSWORD
healthcheck:
test: ["CMD-SHELL", "pg_isready --dbname=$${POSTGRES_DB} --username=$${PGSQL_USER}"]
interval: 60s
timeout: 5s
retries: 3
stop_grace_period: 1m
server:
hostname: zabbix
image: zabbix/zabbix-server-pgsql:alpine-6.4-latest
restart: always
ports:
- 10051:10051
env_file:
- ./env_vars/.env_srv
- ./env_vars/.env_pgsql
secrets:
- POSTGRES_USER
- POSTGRES_PASSWORD
volumes:
- server-usr-lib:/usr/lib/zabbix
- server-var-lib:/var/lib/zabbix
depends_on:
- postgres
#ulimits:
# nproc: 65535
# nofile:
# soft: 20000
# hard: 40000
#deploy:
# resources:
# limits:
# cpus: '0.70'
# memory: 1G
# reservations:
# cpus: '0.5'
# memory: 512M
sysctls:
- net.ipv4.ip_local_port_range=1024 65000
- net.ipv4.conf.all.accept_redirects=0
- net.ipv4.conf.all.secure_redirects=0
- net.ipv4.conf.all.send_redirects=0
volumes:
postgres:
server-usr-lib:
server-var-lib:
###
### Networks
###
networks:
default:
enable_ipv6: true
ipam:
driver: default
config:
- subnet: fd00:5c32:de45::/80
gateway: fd00:5c32:de45::1
traefik:
external: true
secrets:
POSTGRES_USER:
file: ./env_vars/.POSTGRES_USER
POSTGRES_PASSWORD:
file: ./env_vars/.POSTGRES_PASSWORD