ZABBIX – réduire la taille de la db


If you are using Zabbix for a long time, then you might notice that the database size of Zabbix is increasing every day. Then you should delete the old data from the database.

  1. login to the MySQL.
  2. Select your database (Which is used for zabbix)
  3. Run below commands (Please change the interval day as your requirement)

DELETE FROM history_uint WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 35 DAY));
DELETE FROM history WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 35 DAY));
DELETE FROM trends_uint WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 35 DAY));
DELETE FROM trends WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 35 DAY));
DELETE FROM events WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 35 DAY));
DELETE FROM alerts WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 35 DAY));

In my case I am keeping only last 35 Days data, so change as per your requirement.

,