[ZBX-20423] timescaledb error during zabbix v6.0 setup Created: 2022 Jan 11  Updated: 2022 Jan 12  Resolved: 2022 Jan 12

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Mehmet Ali Buyukkarakas Assignee: Zabbix Support Team
Resolution: Won't fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2022-01-12-14-47-32-915.png     PNG File image-2022-01-12-14-49-47-187.png     PNG File image-2022-01-12-14-50-12-850.png     PNG File image-2022-01-12-15-03-15-135.png    

 Description   

I'm testing zabbix v6.0 beta with the specifications below ;

OS : CentOS Stream release 8

Zabbix version : zabbix-release-5.5-1.el8 

PostgreSQL version :  PostgreSQL 13.5

After finishing the setup of Zabbix + PGSQL, I created the timescaledb repo. I ran following commands.

# sudo tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOL

[timescale_timescaledb]
name=timescale_timescaledb
baseurl=https://packagecloud.io/timescale/timescaledb/el/8/\$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
EOL 

# yum install timescaledb-2-loader-postgresql-13-2.1.1
# yum install timescaledb-2-postgresql-13-2.1.1

# echo "shared_preload_libraries = 'timescaledb'" >> /var/lib/pgsql/13/data/postgresql.conf
# echo "timescaledb.license=timescale" >> /var/lib/pgsql/13/data/postgresql.conf
# sudo systemctl restart postgresql-13
# sudo -u postgres timescaledb-tune --quiet --yes --pg-config=/usr/pgsql-13/bin/pg_config
# echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u postgres psql zabbix 2>/dev/nullcat /usr/share/doc/zabbix-sql-scripts/postgresql/timescaledb.sql | sudo -u zabbix psql zabbix

 

After executing the last command ,whatever I change I receive the same error.

 

NOTICE:  PostgreSQL version 13.5 is valid
NOTICE:  TimescaleDB extension is detected
NOTICE:  TimescaleDB version 2.2.1 is valid
ERROR:  relation "history" does not exist
LINE 1: SELECT create_hypertable('history', 'clock', chunk_time_inte...
                                 ^
QUERY:  SELECT create_hypertable('history', 'clock', chunk_time_interval => 86400, migrate_data => true)
CONTEXT:  PL/pgSQL function inline_code_block line 59 at PERFORM 

I made my tests beginning from timescaleDB v2.1 to v2.3. Each time I got the same results.

Regards.

Mehmet

 



 Comments   
Comment by Artjoms Rimdjonoks [ 2022 Jan 12 ]

mbuyukkarakas timescaleDB extension must be configured on the already installed zabbix postgresql database (so, you need to follow PostgreSQL DB installation notes first),
I think we need to update our documentation to make it clearer

Comment by Mehmet Ali Buyukkarakas [ 2022 Jan 12 ]

 I think you misunderstood.

 

I did exactly the same.

1) PG setup

2) Zabbix setup

3) TS setup.

 

I dont understand what is the difference. Even before or after, It doesnt change anything. Same results. The TS script cannot be applied to the system.

Please reopen the issue and lets solve this.

thank you.

Comment by Mehmet Ali Buyukkarakas [ 2022 Jan 12 ]

I think you misunderstood.

 

I did exactly the same.

1) PG setup

2) Zabbix setup

3) TS setup.

 

I dont understand what is the difference. Even before or after, It doesnt change anything. Same results. The TS script cannot be applied to the system.

Please reopen the issue and lets solve this.

thank you.

Comment by Artjoms Rimdjonoks [ 2022 Jan 12 ]

mbuyukkarakas
So, you are suggesting you did setup Postgresql and run the following commands from the PG manual:

shell> cd database/postgresql
shell> cat schema.sql | sudo -u zabbix psql zabbix # stop here if you are creating database for Zabbix proxy
shell> cat images.sql | sudo -u zabbix psql zabbix
shell> cat data.sql | sudo -u zabbix psql zabbix

?

Comment by Mehmet Ali Buyukkarakas [ 2022 Jan 12 ]

Thank you.

So I'm installing from centos packages, and according the documentation and the download page (https://www.zabbix.com/download?zabbix=6.0&os_distribution=centos&os_version=8&db=postgresql&ws=apache) I'm only running server.sql.gz script. (By the way, what you are listing above are not existing in a fresh rpm installation, please see the screenshot below)

 

 

So, I assume I did my work well. First installed PG, than zabbix server and finally TS. 

For me it's still a unknown, why its happening.

thank you.

 

Comment by Artjoms Rimdjonoks [ 2022 Jan 12 ]

mbuyukkarakas Well, after you installed the software - you had to configure the database.
Did you go through the PostgresSQL(Timescale is PostgreSQL) setup manual
and prepared your DB for the Zabbix use:

shell> cd database/postgresql
shell> cat schema.sql | sudo -u zabbix psql zabbix # stop here if you are creating database for Zabbix proxy
shell> cat images.sql | sudo -u zabbix psql zabbix
shell> cat data.sql | sudo -u zabbix psql zabbix

?

Comment by Mehmet Ali Buyukkarakas [ 2022 Jan 12 ]

Documentation says I dont need to use these scripts. Or the documentation is wrong.

 

 

 

Comment by Artjoms Rimdjonoks [ 2022 Jan 12 ]

mbuyukkarakas Right, so this line says:

If you are installing from Zabbix packages, stop here and continue with instructions for RHEL/CentOS or Debian/Ubuntu to import the initial schema and data into the database. 

Did you:

continue with instructions for RHEL/CentOS or Debian/Ubuntu to import the initial schema and data into the database. 

?

You must:

import the initial schema and data into the database
Comment by Mehmet Ali Buyukkarakas [ 2022 Jan 12 ]

Yes I did.

I ınstalled from rpm packages and ran these commands.

 

# sudo -u postgres psql -c "CREATE USER zabbix WITH ENCRYPTED PASSWORD 'xxxxxx'" 2>/dev/null
# sudo -u postgres createdb -O zabbix -E Unicode -T template0 zabbix 2>/dev/null 
# zcat /usr/share/doc/zabbix-sql-scripts/postgresql/create.sql.gz | sudo -u zabbix PGPASSWORD=xxxxxxxx psql -hlocalhost -Uzabbix zabbix 2>/dev/null

So I imported the initial schema.

I dont understand why cant we agree on these commands. I just follow the documentation and do what it recommends.

 

Comment by Artjoms Rimdjonoks [ 2022 Jan 12 ]

mbuyukkarakas instructions there do not mention anywhere redirecting the output into dev/null

2>/dev/null
Comment by Mehmet Ali Buyukkarakas [ 2022 Jan 12 ]

Really ? Is the the problem ?

So you tell me, all my commands are not working because I redirect output to dev/null ?

 

Guys, serioulsy ; can we pass this command syntax things ? My commands are ok and working. None of them wont fail because of this redirection. 

 

Comment by Artjoms Rimdjonoks [ 2022 Jan 12 ]

arimdjonoks this redirection hides the root cause of the actual problem,
this script that populates the DB must fail and you silence it with this redirection, if it succeeded - you would have the history table available and timescaleDB setup script would also succeeded

Comment by Mehmet Ali Buyukkarakas [ 2022 Jan 12 ]

Artjoms, thank you for redirecting me to proper syntax. I dont know when but name of initial schema file has changed from create.sql.gz to server.sql.gz. So, its my mistake. After removing the redirections I saw the error and corrected the script.

Now timescaleDB v2.1.1 has been installed and its working.

Regards.

 

PS: This conversation could be shorter and less stressfull than this, if you could tell me directly "the schema file name is wrong". But thanks anyway. 

Generated at Thu Jun 19 08:44:32 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.