Ad Widget

Collapse

Why is DB empty for me

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jklm
    Junior Member
    • Nov 2025
    • 1

    #1

    Why is DB empty for me

    Hi,

    I setup Zabbix with this docker-compose.yml file: https://pastebin.com/PxHSRzTx
    After I started it with: docker compose up, I can login to the web ui and it works great.
    But now I want to connect to the postgresql database and list the tables in there, but when I do that they are all empty. If I first list running containers, there is:
    postgres:16 with name zabbix-postgres-1 running on port 5432.
    Then I go into the contianer with: docker exec -it <id> bash
    Then I run these commands:
    psql -U zabbix
    \c zabbix
    \dt

    I see a lot of tables which looks fine, for example hosts table. But when doing: select * from hosts, I get no results. I also don't get it from any other table, why not? What am I doing wrong? In the GUI, there is one host which is the agent running on my own machine where I spin up the docker. So why can't I see the data in the database?

    I appreciate all help, thank you!
  • Viktors Fomics
    Member
    • Oct 2025
    • 42

    #2
    Hello

    As you have stated, you see postgres:16 with name zabbix-postgres-1 running on port 5432, however in your yml file the database container name is different: postgresql-server. Therefore it looks like you are just checking some different container.

    Comment

    • guntis_liepins
      Junior Member
      • Oct 2025
      • 12

      #3
      Regardless of compose file problem this is what you should know.
      Zabbix does not create database structure by itself. Database and database structure must be created as described in https://www.zabbix.com/documentation...all/db_scripts
      You did not specified OS , but for ubuntu you have to install zabbix package zabbix-sql-scripts and execute scripts /usr/share/zabbix/sql-scripts.
      There are another way - you can use Compose method described in https://www.zabbix.com/documentation...ion/containers and install zabbix from https://github.com/zabbix/zabbix-docker .
      These dockerfiles have special one-time run init containers which create DB structure for you. These dockerfiles are very flexible , yet have some learning curve to use them.
      P.S. do not run agent in container - you will have hard time to monitor host and connect everywhere as docker create isolated network and restric access to host resources.

      Comment

      Working...