Ad Widget

Collapse

Table 'dbversion' was not found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pwrdwn
    Junior Member
    • Jan 2022
    • 2

    #1

    Table 'dbversion' was not found

    Hello all,
    I am new to Zabbix and would need some help.

    I am trying to install Zabbix in configuration where I have Postgresql separated from the other components in another Proxmox container. I am running Postgresql 13 on Ubuntu 21.04 and am trying to install Zabbix 5.4 on Ubuntu 20.04.

    For the installation process I am following the guide on the https://www.zabbix.com/download page (steps a., b., d., e., and f.) and the guide on the https://www.zabbix.com/documentation...all/db_scripts for the initial database creation. Since the database server is on the separate container I am assuming that the database creation proccess needs to be executed on the database container, and for that reason I have copied the file /usr/share/doc/zabbix-sql-scripts/postgresql/create.sql.gz from the zabbix container to the database one. The user is also created in the database container, but I can't use it to unpack the create.sql.gz file to the previously created database (I have to use the postgres user for that). On the Zabbix container I also add DBHost=<IP_of_the_DB_host> to the /etc/zabbix/zabbix_server.conf file, and of course add the DBPassword=<password_of_zabbix_db_user>. When I do the systemctl restart apache2 zabbix-server zabbix-agent command on the Zabbix container it finishes suspiciously fast and when I check the systemctl status zabbix-server it is shown as activating, but when I try to proceed with frontend installation everything works. Ishould add that when I try to do systemctl start zabbix-server command it just hangs up and it seemingly never finishes.

    The problem comes up when I try to connect to the database, when I get the >>Unable to determine current Zabbix database version: the table "dbversion" was not found.<< and I don't have a clue on how to fix it. All possible fixes I have found are suggesting to create the database from the create.sql.gz file but since I believe I have already done that, I don't know what to do.

    Can someone please help me?
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    It sounds like you're on the right track, but what you should verify before doing anything else is that the database was created and populated with the necessary (mostly empty) tables.

    What I would do in your situation is to install the PostgreSQL command line client on your Zabbix server; you don't need to have it there permanently if you don't want, but you'll have a good test when you can connect from your Zabbix server to the database and actually verify there are tables, etc.

    I typically use other Linux distros (not Ubuntu), but I think the Ubuntu package you want to install on your Zabbix server is called 'postgresql-client'. You may need to verify that, but when installed there should be a 'psql' command available. That's the command-line client.

    Once you have 'psql' on your Zabbix server, you should be able to execute (as your normal user; this doesn't require root or any special user):

    Code:
    psql -h IP_of_the_DB_host -d zabbix -U zabbix -W
    That says you want to connect to the default postgresql database port on host IP_of_the_DB_host, accessing database 'zabbix' as user 'zabbix' and prompt for the zabbix user password for the database.

    If you can connect, you'll get an interactive prompt. From there, you can issue SQL and psql meta-commands to make certain that your tables have been created within the 'zabbix' database.

    Check the 'psql' man page once you have it installed, but you basically want to do something like

    Code:
    \d dbversion
    once you've connected, at the 'psql' prompt, to "describe" the "dbversion" database "object", which should be a table if the Zabbix schema was created correctly.

    I think (but am not certain; it has been a couple years since I've used Postgresql) you could also do

    Code:
    \d
    to just list all tables. You should get a bunch of output from that.

    As explained in the man page, when you're ready to quit the 'psql' client, it's

    Code:
    \q
    to quit.

    Please try that procedure and see if your database does have all the tables created, as you expect. That will tell you if the problem is with the database itself or if it's some kind of access issue between the two containers.

    Comment

    • pwrdwn
      Junior Member
      • Jan 2022
      • 2

      #3
      tim.mooney thank you for the advice.

      Thank you for the advice. I poked around the database and discovered that it was an access issue in the database. The database user didn't have any priviliges on the tables in the database, despite being its owner. Granted him all privileges now and it is working as it should be.

      Comment

      Working...