清理zabbix历史数据

zabbix历史记录一般是这几个表

清理历史记录就是清理这几个表

简单粗暴清理

直接重建表

TRUNCATE TABLE history;

OPTIMIZE TABLE history;

TRUNCATE TABLE history_uint;

OPTIMIZE TABLE history_uint;

TRUNCATE TABLE history_str;

OPTIMIZE TABLE history_str;

TRUNCATE TABLE history_text;

OPTIMIZE TABLE history_text;

按日期清理

例如:清理一个月前的数据 当前时间 2022-08-15
访问 时间戳转换工具 转换时间戳

DELETE FROM  history WHERE  clock < 1657857865;
DELETE FROM  history_uint WHERE  clock < 1657857865;
DELETE FROM  history_str WHERE  clock < 1657857865;
DELETE FROM  history_text WHERE  clock < 1657857865;

最后重启服务

systemctl start zabbix-server
posted @ 2023-05-15 11:09  厚礼蝎  阅读(749)  评论(0)    收藏  举报