A
A
Alex2022-04-13 09:38:56
Zabbix
Alex, 2022-04-13 09:38:56

Why is zabbix-agent not connecting to Docker?

Started learning Docker.
I want to set up a Zabbix monitoring server on containers.
The server itself is working, connected network equipment, but the server itself where Zabbix is ​​installed cannot be connected

62566fd68bf17396011869.jpeg
Error "Get value from agent failed: cannot connect to [[127.0.0.1]:10050]: [111] Connection refused"

I create containers as follows:

spoiler
sudo docker run -d \
--name zabbix-postgres \
--network zabbix-net \
-v /var/lib/zabbix/timezone:/etc/timezone \
-v /var/lib/zabbix/localtime:/etc/localtime \
-e POSTGRES_PASSWORD=zabbixpass \
-e POSTGRES_USER=zabbix postgres:alpine


sudo docker run \
--name zabbix-server \
--network zabbix-net \
-v /var/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts \
-v /var/lib/zabbix/timezone:/etc/timezone \
-v /var/lib/zabbix/localtime:/etc/localtime \
-p 10051:10051 -e DB_SERVER_HOST="zabbix-postgres" \
-e POSTGRES_USER="zabbix" \
-e POSTGRES_PASSWORD="zabbixpass" \
-d zabbix/zabbix-server-pgsql:alpine-latest


sudo docker run \
--name zabbix-web \
-p 80:8080 -p 443:8443 \
--network zabbix-net \
-e DB_SERVER_HOST="zabbix-postgres" \
-v /var/lib/zabbix/timezone:/etc/timezone \
-v /var/lib/zabbix/localtime:/etc/localtime \
-e POSTGRES_USER="zabbix" \
-e POSTGRES_PASSWORD="zabbixpass" \
-e ZBX_SERVER_HOST="zabbix-server" \
-e PHP_TZ="Asia/Yekaterinburg" \
-d zabbix/zabbix-web-nginx-pgsql:alpine-latest

sudo docker run \
 --name zabbix-agent \
 --restart=always \
 -e ZBX_HOSTNAME="Zabbix-server" \
 -e ZBX_LISTENPORT="10050" \
 -p 10050:10050 \
 -e ZBX_SERVER_HOST="127.0.0.1,localhost" \
 -d zabbix/zabbix-agent:alpine-latest

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
A
Anton Kuzovov, 2022-04-26
@iAHTOH

I turned it off in my place (there can be nothing interesting there), but I installed agent 2 on the Host machine. Actually, he monitors all containers.
62679feced6f1299343252.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question