zabbix清理旧数据
zabbix 清理旧数据
在泗县等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站制作、成都做网站 网站设计制作按需开发,公司网站建设,企业网站建设,品牌网站制作,全网营销推广,成都外贸网站建设公司,泗县网站建设费用合理。
#!/bin/bash User=user Passwd=passwd Date=`date -d $(date -d "-30 day" +%Y%m%d) +%s` #取30天之前的时间戳 $(which MySQL) -u${User} -p${Passwd} -S /tmp/mysql.sock -e " use zabbix; DELETE FROM history WHERE 'clock' < $Date; optimize table history; DELETE FROM history_str WHERE 'clock' < $Date; optimize table history_str; DELETE FROM history_uint WHERE 'clock' < $Date; optimize table history_uint; DELETE FROM history_text WHERE 'clock' < $Date; optimize table history_text; DELETE FROM trends WHERE 'clock' < $Date; optimize table trends; DELETE FROM trends_uint WHERE 'clock' < $Date; optimize table trends_uint; DELETE FROM events WHERE 'clock' < $Date; optimize table events; "
mysql ibdata空间清理
mysqldump -u [username] -p[root_password] [database_name] > dumpfilename.sql DROP DATABASE database_name /etc/init.d/mysqld stop rm /var/lib/mysql/ibdata1 rm /var/lib/mysql/ib_logfile* /etc/init.d/mysqld start create database [database_name] mysql -u [username]-p[root_password] [database_name] < dumpfilename.sql
本文标题:zabbix清理旧数据
分享路径:http://ybzwz.com/article/pdjegc.html