dockerzabbix

Zabbix web server to Zabbix server connection not working


Installating a zabbix stack with a docker composed I noticed I could set up everything quite easily following the default docker compose.

Reporting the version of the images below:

docker.io/postgres:16.2
docker.io/zabbix/zabbix-server-pgsql:alpine-7.0-latest
docker.io/zabbix/zabbix-web-nginx-pgsql:alpine-7.0-latest
docker.io/zabbix/zabbix-agent2:alpine-7.0-latest

However I can't get rid of the following error, reported on the main dashboard:

Connection to Zabbix server "localhost:10051" refused. Possible reasons:
1. Incorrect "NodeAddress" or "ListenPort" in the "zabbix_server.conf" or server IP/DNS override in the "zabbix.conf.php";
2. Security environment (for example, SELinux) is blocking the connection;
3. Zabbix server daemon not running;
4. Firewall is blocking TCP connection. Connection refused

Adding image below:

enter image description here

Up to now I only understood that the connection I am trying to debug is straight between the zabbix web server and the backend server, and seems to be used also for HA ( I think it is the one roughly highlighted in the image below.

enter image description here

I don't think it is crucial for the correct functioning of Zabbix but I would rather have everything neatly working with the basic setup before moving on to add hosts/templates.


Solution

  • What I was missing was to set ZBX_SERVER_HOST to the name of the service defined in the docker-compose file.

    Maybe I am missing a point but I believe ZBX_SERVER_HOST should be present in the docker-compose example because the default localhost that ZBX_SERVER_HOST goes to, will not result in a correct connection in most containerized configuration of Zabbix web server + Zabbix server.

    In my case the relevant part of the docker compose is:

    services:
      zabbix-server:
      ...
      zabbix-web:
        environment:
          ...
          - ZBX_SERVER_HOST=zabbix-server