Repair the cacti database or any MySQL database.

When you not able to add any new server in cacti. When you not able to view any server graph reading in cacti.
That means your cacti database is corrupted or crashed. Check the MySQL log and confirm the same.

[root@local ~]# tail -f /var/log/mysqld.log
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired
120131 16:25:01 [ERROR] /usr/libexec/mysqld: Table './cacti/poller_item' is marked as crashed and should be repaired

MySQL log showing cacti database is corrupted or crashed. Follow the below steps to repair it.
  
STEP 1:- Check the corrupted table.
[root@localhost ~]# mysqlcheck -c cacti -p
Enter password:
cacti.cdef                                        OK
cacti.cdef_items                                  OK
cacti.colors                                      OK
cacti.data_input                                  OK
cacti.data_input_data
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.data_input_fields                           OK
cacti.data_local
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.data_template                               OK
cacti.data_template_data
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.data_template_data_rra
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.data_template_rrd
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.graph_local
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.graph_template_input                        OK
cacti.graph_template_input_defs                   OK
cacti.graph_templates
warning  : 1 client is using or hasn't closed the table properly
status   : OK
cacti.graph_templates_gprint                      OK
cacti.graph_templates_graph
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.graph_templates_item
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.graph_tree                                  OK
cacti.graph_tree_items
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.host
warning  : 5 clients are using or haven't closed the table properly
status   : OK
cacti.host_graph
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.host_snmp_cache
warning  : 3 clients are using or haven't closed the table properly
status   : OK
cacti.host_snmp_query
warning  : 3 clients are using or haven't closed the table properly
status   : 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.plugin_thold_contacts                       OK
cacti.plugin_thold_log                            OK
cacti.plugin_thold_template_contact               OK
cacti.plugin_thold_threshold_contact              OK
cacti.poller                                      OK
cacti.poller_command
warning  : 2 clients are using or haven't closed the table properly
status   : OK
cacti.poller_item
warning  : Table is marked as crashed
warning  : 4 clients are using or haven't closed the table properly
error    : Checksum for key:  4 doesn't match checksum for records
warning  : Found 204104 deleted space.   Should be 203016
warning  : Found 1358 deleted blocks       Should be: 1324
error    : Corrupt
cacti.poller_output                               OK
cacti.poller_reindex
warning  : 5 clients are using or haven't closed the table properly
status   : OK
cacti.poller_time                                 OK
cacti.rra                                         OK
cacti.rra_cf                                      OK
cacti.settings
warning  : 9 clients are using or haven't closed the table properly
status   : 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.thold_data                                  OK
cacti.thold_template                              OK
cacti.user_auth                                   OK
cacti.user_auth_perms                             OK
cacti.user_auth_realm                             OK
cacti.user_log
warning  : 4 clients are using or haven't closed the table properly
status   : OK
cacti.version                                     OK

STEP 2:- Run the below command twice to repair cacti database.
[root@localhost ~]# mysqlcheck -p --auto-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.plugin_thold_contacts                       OK
cacti.plugin_thold_log                            OK
cacti.plugin_thold_template_contact               OK
cacti.plugin_thold_threshold_contact              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.thold_data                                  OK
cacti.thold_template                              OK
cacti.user_auth                                   OK
cacti.user_auth_perms                             OK
cacti.user_auth_realm                             OK
cacti.user_log                                    OK
cacti.version                                     OK

You get the OK every line that means, all the tables are repaired successfully.

8 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... Allied Gardens appliance Repair service

    ReplyDelete
  3. Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. SubZero, Viking Ice Maker Repair Marina Del Rey

    ReplyDelete
  4. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. washer repairman

    ReplyDelete
  5. I would like to say that this blog really convinced me to do it! Thanks, very good post. SubZero, Viking Ice Maker Repair Manhattan Beach

    ReplyDelete
  6. I would like to say that this blog really convinced me to do it! Thanks, very good post. Viking repair Malibu

    ReplyDelete
  7. Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading. Viking , Wolf, Dacor Stove & Range Repair Monterey Park

    ReplyDelete
  8. You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. Testimonials Appliance Repair

    ReplyDelete