cacti数据库修复

      这几天自己的搭建的cacti监控系统没有了数据,只有图形。查看日志发现如下错误:

     tail /var/www/html/log/cacti.log

    08/22/2012 09:35:41 AM - SPINE: Poller[0] ERROR: SQL Failed! Error:'1062', Message:'Duplicate entry '410-traffic_out-2012-08-22 09:35:20' for key 'PRIMARY'', SQL Fragment:'INSERT INTO poller_output (local_data_id, rrd_name, time, output) VALUES (410,'traffic_out','2012-08-22 09:35:20','3522970564731'),(409,'traffic_in','2012-08-22 09:35:20','4892369527777'),(409,'traffic_out','2012-08-22 09:35:20','9512813531381'),(408,'traffic_out','2012-08-22 09:35:20','299214478'),(408,'traffic_in','2012-08-22 09:35:20','299214478'),(403,'hdd_total','2012-08-22 09:35:20','21137731584'),(403,'hdd_used','2012-08-22 09:35:20','5812596736'),(402,'hdd_used','2012-08-22 09:35:20','0'),(402,'hdd_total','2012-08-22 09:35:20','1052250112'),(401,'hdd_used','2012-08-22 09:35:20','6715084800'),(401,'hdd_total','2012-08-22 09:35:20','10039418880'),(400,'hdd_total','2012-08-22 09:35:20','536862720'),(400,'hdd_used','2012-08-22 09:35:20','671744'),(399,'hdd_used','2012-08-22 09:35:20','1184247808'),(399,'hdd_total','2012-08-22 09:35:20','1184247808'),(398,'hdd_used','2012-08-22 09:35:20','339902464'),(398,'hdd_total','2012-08-22 09:35:20','2104500224'),(397,'hdd_used','2012-08-22 09:35:20','1928376320'),('

08/22/2012 09:35:47 AM - SPINE: Poller[0] ERROR: SQL Failed! Error:'1062', Message:'Duplicate entry '420-apache_cpuload-2012-08-22 09:35:41' for key 'PRIMARY'', SQL Fragment:'INSERT INTO poller_output (local_data_id, rrd_name, time, output) VALUES (420,'apache_cpuload','2012-08-22 09:35:41','0'),(421,'apache_total_hits','2012-08-22 09:35:41','0'),(422,'apache_total_kbytes','2012-08-22 09:35:41','0'),(423,'','2012-08-22 09:35:41','0'),(424,'','2012-08-22 09:35:41','0'),(425,'','2012-08-22 09:35:41','thread_W:0 threadS:0 threadR:0 threadW:0 threadK:0 threadD:0 threadC:0 threadL:0 threadG:0 threadI:0 thread_O:0'),(426,'apache_total_hits','2012-08-22 09:35:41','0'),(427,'apache_total_kbytes','2012-08-22 09:35:41','0')'

    把上面的sql语句手工执行后,发现mysql报一下错误:

    

    这是mysql数据库崩溃了,在网上找到一些解决方法,使用命令myisamchk修复数据库的MYI文件即可,

usr/local/mysql5/bin/myisamchk -c -r  /var/lib/mysql/poller_item.MYI

修复后可以正常运行了。

参考文献:http://hi.baidu.com/pomtch_wenwen/item/9cdf38cdac36ae1eb77a2401

         http://www.chinahtml.com/0610/mysql-11619183797660.html

你可能感兴趣的:(mysql,cacti)