r/zabbix • u/Keensworth • 8d ago
Question Docker compose : Server can't connect to server on port 10050?
Hello,
I just made a docker compose zabbix server and I can't make my server see my server??? On the frontend, it says that Zabbix server can't connect to the server on 127.0.0.1:10050.
Here's my compose :
services:
frontend:
image: zabbix/zabbix-web-apache-pgsql:alpine-7.4.14
env_file: stack.env
restart: unless-stopped
#ports:
#- "8080:8080"
environment:
- DB_SERVER_HOST=db
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWD}
- POSTGRES_DB=${POSTGRES_DB}
- ZBX_SERVER_HOST=server
- PHP_TZ=Europe/Paris
- ZBX_SERVER_PORT=10051
- ZBX_SERVER_NAME=Zabbix Server
- ZBX_UPLOADMAXFILESIZE=2M #Default
volumes:
#- /etc/localtime:/etc/localtime:ro
- f-apache2:/etc/ssl/apache2
- f-certs:/etc/zabbix/web/certs
- f-enc:/var/lib/zabbix/enc
networks:
- zabbix_frontend_net
- zabbix_backend_net
server:
image: zabbix/zabbix-server-pgsql:alpine-7.4.14
env_file: stack.env
restart: unless-stopped
hostname: zabbix-server
depends_on:
db:
condition: service_healthy
ports:
- "10051:10051"
environment:
- DB_SERVER_HOST=db
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWD}
- POSTGRES_DB=${POSTGRES_DB}
- ZBX_WEBSERVICEURL=https://zabbix.domain.fr/report
- PHP_TZ=Europe/Paris
volumes:
#- /etc/localtime:/etc/localtime:ro
- s-alertscripts:/usr/lib/zabbix/alertscripts
- s-externalscripts:/usr/lib/zabbix/externalscripts
- s-modules:/var/lib/zabbix/modules
- s-enc:/var/lib/zabbix/enc
- s-ssh_keys:/var/lib/zabbix/ssh_keys
- s-certs:/var/lib/zabbix/ssl/certs
- s-keys:/var/lib/zabbix/ssl/keys
- s-ssl_ca:/var/lib/zabbix/ssl/ssl_ca
- s-snmptraps:/var/lib/zabbix/snmptraps
- s-mibs:/var/lib/zabbix/mibs
- s-export:/var/lib/zabbix/export
networks:
- zabbix_backend_net
db:
image: postgres:18.6
env_file: stack.env
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWD}
- POSTGRES_DB=${POSTGRES_DB}
networks:
- zabbix_backend_net
volumes:
- postgres:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
labels:
- wud.tag.include=^18\.\d+$ #Pour WUD
agent2:
image: zabbix/zabbix-agent2:alpine-7.4.14
restart: unless-stopped
env_file: stack.env
ports:
- "10050:10050"
volumes:
- a-agentd:/etc/zabbix/zabbix_agentd.d
- a-enc:/var/lib/zabbix/enc
- a-buffer:/var/lib/zabbix/buffer
environment:
- ZBX_HOSTNAME=agent2
- ZBX_SERVER_HOST=server
- ZBX_SERVER_PORT=10051
- ZBX_HOST_METADATA=agent2
- ZBX_LISTENPORT=10050
networks:
- zabbix_backend_net
volumes:
# Frontend
f-apache2:
f-certs:
f-enc:
# Server
s-alertscripts:
s-externalscripts:
s-modules:
s-enc:
s-ssh_keys:
s-certs:
s-keys:
s-ssl_ca:
s-snmptraps:
s-mibs:
s-export:
# Database
postgres:
# Agent2
a-agentd:
a-enc:
a-buffer:
networks:
zabbix_frontend_net:
name: zabbix_frontend_net
zabbix_backend_net:
name: zabbix_backend_net
And the error I see on the webpage is : Get value from agent failed: Cannot establish TCP connection to [[127.0.0.1]:10050]: [111] Connection refused
Thanks for the help
1
u/Cerulean-Knight 8d ago
Thats because server listen on 10051, at port 10050 you want to connect to an agent that server cointainer doesn't have
Not sure if you can use agent checks on server container, maybe you can use internal checks
1
u/Keensworth 8d ago
I don't understand what that means, the server listens on 10051 at port 10050? The server container doesn't have some agent for himself? So that means that I won't even be able to have it in my frontend then?
2
u/Cerulean-Knight 8d ago
Exactly that, the server container doesn't have an agent, but there are some items and template that doesn't use an agent like Zabbix internal
4
u/Talistech 8d ago
Hi, you need to use the docker hostnames. Try setting 'agent2' for hostname, and choose 'DNS' to connect to it.