清理Zabbix Server历史数据

先停止zabbix_server,防止有数据写入

清理全部历史数据

对zabbix数据库执行MySQL语句

truncate table history;
optimize table history;

truncate table history_uint;
optimize table history_uint;

truncate table trends;
optimize table trends;

truncate table trends_uint;
optimize table trends_uint;

清理指定时间之前的数据

生成Unix时间戳,时间为2018年3月1日

date +%s -d 20180301
1519833600

对zabbix数据库执行MySQL语句

delete from history where clock < 1519833600;
optimize table history;

delete from history_uint where clock < 1519833600;
optimize table history_uint;

delete from trends where clock < 1519833600;
optimize table trends;

delete from trends_uint where clock < 1519833600;
optimize table trends_uint;

来源:
http://blog.51cto.com/6034036/1636779

https://www.cnblogs.com/Oman/p/5945017.html