Upgrade Zabbix database history tables to Double Precision

History Table message in System Information

When the following message is shown in the Zabbix System Information Pane, it is time to upgrade your history tables to Double Precision:

Support for the old numeric type is deprecated. Please upgrade to numeric values of extended range.


Lets change this

The following assumes you use MySQL and Ansible. And you upgraded from Zabbix version 5 or earlier to Zabbix 6+.

1) Make a backup or snapshot of the machine that runs the Zabbix DB
2) systemctl stop zabbix-server.service
3) Collect your Zabbix DBName, DBUser and DBPassword
4) Continue with the steps below

Example of user, database name and password:

DBUser=zabbix
DBName=zabbix
DBPassword=mySecretPassword!

To set

user@servername:~# cat double.sql
ALTER TABLE trends
        MODIFY value_min DOUBLE PRECISION DEFAULT '0.0000' NOT NULL,
        MODIFY value_avg DOUBLE PRECISION DEFAULT '0.0000' NOT NULL,
        MODIFY value_max DOUBLE PRECISION DEFAULT '0.0000' NOT NULL;
ALTER TABLE history MODIFY value DOUBLE PRECISION DEFAULT '0.0000' NOT NULL;
 mysql --host=localhost --user=zabbix --password=mySecretPassword! zabbix < double.sql

To confirm

user@servername:~# cat check.sql
SELECT numeric_precision FROM information_schema.columns WHERE table_schema='zabbix' AND table_name='history' AND column_name='value';
mysql --host=localhost --user=zabbix --password=mySecretPassword! zabbix < check.sql

Check Results

Output OK (change applied):

numeric_precision
22

Output Not OK (change not applied):

numeric_precision
16

When the output is OK:

Set zabbix_web_doubleprecision to yes/true for the Ansible host or group_vars:

Run your Ansible playbook when needed to apply the change to the Zabbix Web interface.

Or change/set $DB['DOUBLE_IEEE754'] value to true in /ui/conf/zabbix.conf.php.
This removes the message from the System Information pane.

And start your Zabbix service again:

systemctl start zabbix-server.service


Sources

Zabbix KB: https://www.zabbix.com/documentation/current/en/manual/appendix/install/db_float_range
Zabbix MySQL script: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/database/mysql/option-patches/double.sql?at=refs%2Fheads%2Frelease%2F6.4
Ansible community.zabbix for Zabbix Web: https://github.com/ansible-collections/community.zabbix/blob/main/roles/zabbix_web/templates/zabbix.conf.php.j2
Manual check of the DB: https://support.zabbix.com/browse/ZBX-18177

Leave a Comment