skip to Main Content

This is my docker-compose file:

version: "3.7"

services:
  zookeeper:
    image: 'confluentinc/cp-zookeeper:latest'
    container_name: pooyesh-zookeeper
    ports: 
      - 2181:2181
    env_file: 
      - zookeeper.env  
  kafka:
    image: 'confluentinc/cp-kafka:latest'
    container_name: pooyesh-kafka
    env_file:
      - kafka.env
    ports: 
      - 9093:9093
    depends_on:
      - zookeeper

  postgres:
    image: 'postgres:latest'
    container_name: pooyesh-postgres
    env_file: 
      - postgres.env
    ports:
      - 5342:5432
    volumes: 
      - pooyesh-postgres:/var/lib/postgresql/data/
    
  zabbix-server:
    image: 'zabbix/zabbix-server-pgsql:latest'
    container_name: pooyesh-zabbix-server
    env_file: 
      - zabbix-server.env
    ports: 
      - 10051:10051
    depends_on: 
      - postgres
  zabbix-frontend:
    image: 'zabbix/zabbix-web-nginx-pgsql:latest'
    container_name: pooyesh-zabbix-frontend
    env_file: 
      - zabbix-frontend.env
    ports:
      - 8090:8080
    depends_on:
      - zabbix-server
      - postgres
  zabbix-agent:   # Zabbix agent service that tracks usage and send to zabbix server
    image: zabbix/zabbix-agent:latest
    container_name: pooyesh-zabbix-agent
    privileged: true   #access mode for allowing resource access
    environment:
      - ZBX_SERVER_HOST=zabbix-server #the IP/Dns of Zabbix server
    volumes:
      - pooyesh-zabbix-agent:/etc/zabbix/

volumes: 
  pooyesh-postgres:
  pooyesh-zabbix-agent:
  pooyesy-zabbix-server:

And also these are their related env files:

postgres.env

POSTGRES_USER=pooyesh
POSTGRES_PASSWORD=2110320982
POSTGRES_DB=pooyesh

zabbix-server.env

DB_SERVER_HOST=postgres
DB_SERVER_PORT=5432
POSTGRES_USER=pooyesh
POSTGRES_PASSWORD=2110320982
POSTGRES_DB=pooyesh
ZBX_TIMEOUT=10

zabbix-frontend.env

DB_SERVER_HOST=postgres
DB_SERVER_PORT=5432
POSTGRES_USER=pooyesh
POSTGRES_PASSWORD=2110320982
POSTGRES_DB=pooyesh
ZBX_SERVER_HOST=zabbix-server
ZBX_SERVER_PORT=10051

When I run the docker-compose file, this is the log which I get from the pooyesh-zabbix-server container:

213:20210929:180535.655 cannot send list of active checks to "172.18.0.3": host [9de9d2980576] not found
198:20210929:182416.233 item "Zabbix server:vfs.fs.size[/,pused]" became not supported: Value of type "string" is not suitable for value type "Numeric (unsigned)". Value "92.887666"

And also this is the log which I get from the pooyesh-zabbix-agent container:

76:20210929:194155.572 active check configuration update from [zabbix-server:10051] started to fail (cannot resolve [zabbix-server])
    76:20210929:194255.588 active check configuration update from [zabbix-server:10051] is working again
    76:20210929:194255.588 no active checks on server [zabbix-server:10051]: host [23d448ba463e] not found

Maybe it is useful to say that I have telnet from each of these two containers to the other one. for example on the pooyesh-zabbix-server I have telnet telnet zabbix-agent 10050

All of these containers are in the same docker-compose network and I don’t know what is wrong.
I also put zabbix-server config file here and zabbix-agent config file here

2

Answers


  1. Chosen as BEST ANSWER

    I finally can resolve my problem. zabbix-agent has an environment variable named ZBX_HOSTNAME which should be the name of the hostname in the zabbix web hosts tab. in my case it was Zabbix server. So when I add ZBX_HOSTNAME=Zabbix server to environment variables of my zabbix-agent and depends on it to the zabbix-server everything is good.


  2. In my case, I needed to update in Zabbix the host IP with the one of it’s Docker container.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search