Skip to content

Simple zabbix mysql/mariadb housekeeping script to maintain zabbix.history and zabbix.history_uint tables

I've just finished a simple houseskeeping/maintenance script for zabbix if you use mariadb or mysql as database.

You can find it here.

It installs a systemd timer to automatically run optimize on the two tables zabbix.history and zabbix.history_uint.

All you have to do is to add your username and passwort to the created file /etc/net.bazzline/zabbix/housekeeping/

Zabbix: Mass update items update interval

The issue was, that we've just added more and more systems and with that items to our zabbix monitoring solution.

The housekeeping process was getting slower and slower so we reasked our self "do we need that kind of accuracy"? Well, for the most parts, we figured out a bit "No". What was left was a handfull of critical sytems.

Instead of checking each host and item, we just noted the critical systems. This list represents the hosts we want to check individually. All otheres where "aligned" with one big mass updated.

We will use pure sql here, either via command line, adminer or what ever you like.

What do you need to know? Inside your database zabbix, there is a table called items. Each item has the column delay which represents the update interval.

After knowing this, we just need to know one more thing. What kind of update intervals do we have.

You fetch this information via the following sql statement.

SELECT `delay` FROM `items` GROUP BY `delay`;

After that, you only have to update each fitting item. For example, if you want to raise the delay from 1 minute to 5 minute just execute the following command.

UPDATE `items` SET `delay` = '5m' WHERE `delay` = '1m'

And that's it.

Zabbix: Required parameter $sql_parts follows optional parameter $table_alias

We are running our monitoring solution zabbix on an arch linux system. Arch linux tends to be "up to date" since it philosophie is "patch current code base, not legacy".

I've updated the monitoring system and with that, the php version jumped from 7.4.x to 8.0.x.

After that, a lot of "widgets" (boxes) in the zabbix frontend displayed me a lot of the following error.

Required parameter $sql_parts follows optional parameter $table_alias [zabbix.php:22 → require_once() → ZBase->run() → CSettingsHelper::getGlobal() → CSettingsHelper::loadParams() → API::getApiService() → CRegistryFactory->getObject() → CApiService->__construct() → CApiService->pk() → CApiService->getTableSchema() → CAutoloader->loadClass() → require() in include/classes/core/CAutoloader.php:77]

I've researched it and found that the error exists in the DB.php class. I've opened the issue Ticket ZBX-18984 and created the pull request 39 on the github source code. Hopefully, this fix will make it quickly into the code. I've added a git patch file to the issue. You can download and apply it on your system.