cacti监控机硬盘满了,于是mysql的表损坏了,通过查看cacti日志的报错信息,搜索到解决办法
[root@w log]# mysql -u root -p cacti
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17497 to server version: 4.1.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use "cacti"
Database changed
mysql> select count(*) from poller_output;
ERROR 1146 (42S02): Table 'cacti.poller_output' doesn't exist
mysql> truncate table poller_output;
ERROR 1146 (42S02): Table 'cacti.poller_output' doesn't exist
mysql>
[root@w log]# cd /var/www/html/cacti/
[root@w cacti]# mysql -uroot -p cactidb <cacti.sql
Enter password:
ERROR 1050 (42S01) at line 5: Table 'cdef' already exists
[root@w cacti]# mysql -uroot -p cactidb <cacti.sql
Enter password:
ERROR 1050 (42S01) at line 5: Table 'cdef' already exists
[root@w cacti]# mysql -u root -p cactidb
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17504 to server version: 4.1.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> mysql -u root -p cacti
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root -p cacti' at line 1
mysql> select count(*) from poller_output;
ERROR 1017 (HY000): Can't find file: 'poller_output' (errno: 2)
mysql> truncate table poller_output;
Query OK, 0 rows affected (0.00 sec)
mysql>
[cacti@w log]$ pwd
/var/www/html/cacti/log
[cacti@w log]$ tailf /var/www/html/cacti/log/cacti.log
[cacti@w ~]$ tailf /var/www/html/cacti/log/cacti.log
07/06/2012 09:25:03 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1017', SQL:"insert into poller_output (local_data_id, rrd_name, time, output) values (102, 'mem_free', '2012-07-06 09:25:03', '19888480')'
07/06/2012 09:25:03 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1017', SQL:"select poller_output.output, poller_output.time, UNIX_TIMESTAMP(poller_output.time) as unix_time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"
07/06/2012 09:25:03 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1017', SQL:"insert into poller_output (local_data_id, rrd_name, time, output) values (101, 'mem_cache', '2012-07-06 09:25:03', '29620896')'
07/06/2012 09:25:03 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1017', SQL:"insert into poller_output (local_data_id, rrd_name, time, output) values (100, 'mem_buffers', '2012-07-06 09:25:03', '135964')'
07/06/2012 09:25:03 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1017', SQL:"select poller_output.output, poller_output.time, UNIX_TIMESTAMP(poller_output.time) as unix_time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"
07/06/2012 09:25:03 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1017', SQL:"insert into poller_output (local_data_id, rrd_name, time, output) values (99, 'load_5min', '2012-07-06 09:25:03', '5.75')'
07/06/2012 09:25:03 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1017', SQL:"insert into poller_output (local_data_id, rrd_name, time, output) values (98, 'load_15min', '2012-07-06 09:25:03', '5.47')'
参考资料参加地址: http://www.cnblogs.com/taosim/articles/2582765.html