MySQL のログに大量の Table ‘./cacti/poller_output’ is marked as crashed and should be repaired が出力される
MySQL のログが急に肥大化していました。調べると以下のようなログが大量に出ていました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired 170502 16:35:04 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_output' is marked as crashed and should be repaired |
また、cacti のログも肥大化しており、以下のようなログが出ていました。
1 2 3 4 5 6 7 8 9 |
05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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" 05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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" 05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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" 05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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" 05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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" 05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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" 05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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" 05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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" 05/02/2017 04:55:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'145', 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) " |
cacti が書き込んでいる MySQL のテーブルが何らかの理由で壊れてしまったようです。
修復方法
phpMyAdmin が入っていれば簡単に修復可能です。
cacti データベースの構造を見ると、エラーが出ている poller_output テーブルが「使用中」となっています。
poller_output にチェックを付けて、「テーブルを修復する」を実行します。
修復が完了するとエラーは無くなります。もっともこのときは修復後レコードが 0件になりましたので、空にしても同じかもしれません。
コマンドラインから実行
同じことですが、phpMyAdmin からではなく、コマンドラインから MySQL のコンソールに入って実行する場合の方法です。
1 2 3 |
REPAIR TABLE `poller_output` ; |
また、SQL の実行ではなくコマンドラインからデータベースをチェックします。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# mysqlcheck -u root -p --repair --databases cacti Enter password: cacti.cdef OK cacti.cdef_items OK cacti.colors OK cacti.data_input OK cacti.data_input_data OK cacti.data_input_fields OK cacti.data_local OK cacti.data_template OK cacti.data_template_data OK cacti.data_template_data_rra OK cacti.data_template_rrd OK cacti.graph_local OK cacti.graph_template_input OK cacti.graph_template_input_defs OK cacti.graph_templates OK cacti.graph_templates_gprint OK cacti.graph_templates_graph OK cacti.graph_templates_item OK cacti.graph_tree OK cacti.graph_tree_items OK cacti.host OK cacti.host_graph OK cacti.host_snmp_cache OK cacti.host_snmp_query OK cacti.host_template OK cacti.host_template_graph OK cacti.host_template_snmp_query OK cacti.plugin_config OK cacti.plugin_db_changes OK cacti.plugin_hooks OK cacti.plugin_realms OK cacti.poller OK cacti.poller_command OK cacti.poller_item OK cacti.poller_output OK cacti.poller_reindex OK cacti.poller_time OK cacti.rra OK cacti.rra_cf OK cacti.settings OK cacti.settings_graphs OK cacti.settings_tree OK cacti.snmp_query OK cacti.snmp_query_graph OK cacti.snmp_query_graph_rrd OK cacti.snmp_query_graph_rrd_sv OK cacti.snmp_query_graph_sv OK cacti.user_auth OK cacti.user_auth_perms OK cacti.user_auth_realm OK cacti.user_log OK cacti.version OK |
これだけですがお困りの時は試してみてください。
ITエンジニア募集中!
キュアコード株式会社はITエンジニアを募集しております。少人数の職場なので、上流・下流やサーバー・クライアント対応の垣根なく、あなたの強みを活かしながら いろいろなことにチャレンジ可能です。エンジニアとしての未経験の方、経験が少ない方も歓迎しています。
下記よりITエンジニア募集の採用情報をご覧いただけます。