[root@zabbix_server zabbix]# cat clean_his.sh
#!/bin/bash
# 清除所有ZBX历史数据
User="root"
Password="123456"
$(which mysql) -u${User} -p${Password} -e"
use zabbix;
truncate history;
optimize table history;
truncate table history_str;
optimize table history_str;
truncate table history_uint;
optimize table history_uint;
truncate table trends;
optimize table trends;
truncate table trends_uint;
optimize table trends_uint;
truncate table events;
optimize table events;"