0

Currently I have the following scenario:

  • First server: I have the Zabbix components: server, gateway and web interface (along with a mysql database), all running via Docker containers (released port: ufw allow 10051).

  • Second server: I have the Zabbix agent running via Docker as well (released port: ufw allow 10050).

Both are Ubuntu 20.04.6 LTS.

...

On the second server where I run the Zabbix agent, I want to monitor the other Docker containers running and the operating system itself.

In the web interface (on the first server) already configure the host that runs the Zabbix agent (I believe it is configured correctly).


THE PROBLEM...

In the web interface, inside the "Issues" section of the Zabbix agent host, it keeps telling me the error (which makes me not receive any information from the agent):

Docker: Service is down

In the Zabbix server container logs I have some error lines like:

discovery rule "hostname:docker.images.discovery" became not supported: Cannot fetch data: Get "http://1.28/images/json": dial unix /var/run/docker.sock: connect: permission denied.

What could be going wrong?


This is the docker-compose.yml from the first server:

version: '3.1'

services:
  zabbix-database:
    image: mysql:latest
    restart: always
    environment:
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix
      - MYSQL_ROOT_PASSWORD=root
    volumes:
      - zabbix-database:/var/lib/mysql
    networks:
      - zabbix-net
    command:
      - --character-set-server=utf8
      - --collation-server=utf8_bin
      - --default-authentication-plugin=mysql_native_password
    healthcheck:
      interval: 10s
      retries: 5
      test: mysqladmin ping -proot

  zabbix-server:
    image: zabbix/zabbix-server-mysql:latest
    restart: always
    ports:
      - "10051:10051"
    environment:
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix
      - MYSQL_ROOT_PASSWORD=root
      - DB_SERVER_HOST=zabbix-database
      - ZBX_JAVAGATEWAY=zabbix-gateway
    networks:
      - zabbix-net
    depends_on:
        zabbix-database:
          condition: service_healthy

  zabbix-web:
    image: zabbix/zabbix-web-nginx-mysql:latest
    restart: always
    ports:
      - "8080:8080"
    environment:
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix
      - MYSQL_ROOT_PASSWORD=root
      - DB_SERVER_HOST=zabbix-database
      - ZBX_SERVER_HOST=zabbix-server
      - PHP_TZ=America/Sao_Paulo
    networks:
      - zabbix-net
    depends_on:
      zabbix-database:
        condition: service_healthy
      zabbix-server:
        condition: service_started

  zabbix-gateway:
    image: zabbix/zabbix-java-gateway:latest
    restart: always
    networks:
      - zabbix-net

volumes:
  zabbix-database:

networks:
  zabbix-net:
    driver: bridge

And this is the docker command for the second server:

docker run \
    --name zabbix-agent \
    --restart unless-stopped \
    -e ZBX_HOSTNAME="hostname-agent-server" \
    -e ZBX_SERVER_HOST="domain.com" \
    -v /proc:/host/proc \
    -v /sys:/host/sys \
    -v /:/host/rootfs \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --publish 10050:10050 \
    --privileged \
    --detach \
    zabbix/zabbix-agent2:latest

However, running the command zabbix_get -s domain.com -k system.hostname or zabbix_get -s domain.com -k system.hw.cpu from inside the Zabbix server container I can get the information returned correctly , without any errors!​

0

You must log in to answer this question.

Browse other questions tagged .