Zabbix Clear DB


#!/bin/bash
User="zabbix"
Passwd="zabbix"
Date=date -d $(date -d "-30 day" +%Y%m%d) +%s - 
$(which mysql) -u${User} -p${Passwd} -e "
use zabbix;
DELETE FROM history WHERE 'clock' < $Date;
optimize table history;
DELETE FROM history_uint WHERE 'clock' < $Date;
optimize table history_uint;

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *