Nagios do2db-3x: mysql_error: 'Incorrect key file for table
Nagios Error Code:-
Jun 23 16:15:40 eznag ndo2db-3x: mysql_error: 'Incorrect key file for table './nagios/nagios_timedevents.MYI'; try to repair it'
Jun 23 16:15:40 eznag ndo2db-3x: Error: mysql_query() failed for 'DELETE FROM nagios_timedeventqueue WHERE instance_id='1' AND scheduled_time<FROM_UNIXTIME(1529750740)'
Jun 23 16:15:40 eznag ndo2db-3x: mysql_error: 'Incorrect key file for table './nagios/nagios_timedeventqueue.MYI'; try to repair it'
Jun 23 16:15:40 eznag ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_hostchecks SET instance_id='1', host_object_id='406', check_type='0', is_raw_check='0', current_check_attempt='1', max_check_attempts='10', state='0', state_type='1', start_time=FROM_UNIXTIME(1529750740), start_time_usec='126616', end_time=FROM_UNIXTIME(0), end_time_usec='0', timeout='30', early_timeout='0', execution_time='0.000000', latency='0.126000', return_code='0', output='', long_output='', perfdata='', command_object_id='1', command_args='', command_line='/usr/local/nagios/libexec/check_ping -H 192\.168\.10\.3 -w 3000\.0,80% -c 5000\.0,100% -p 5' ON DUPLICATE KEY UPDATE instance_id='1', host_object_id='406', check_type='0', is_raw_check='0', current_check_attempt='1', max_check_attempts='10', state='0', state_type='1', start_time=FROM_UNIXTIME(1529750740), start_time_usec='126616', end_time=FROM_UNIXTIME(0), end_time_usec='0', timeout='30', early_timeout='0', execution_time='0.000000', latency='0.126000', return_code='0', output='', long_output='', perfdata='''
Jun 23 16:15:40 eznag ndo2db-3x: mysql_error: 'Incorrect key file for table './nagios/nagios_hostchecks.MYI'; try to repair it'
Resolution:-
Run below Mysql Linux command on Nagios Linux node.
[root@eznag log]#mysqlcheck --user=nagios --password=nagios --repair --all-databases
[root@eznag log]#myisamchk --safe-recover /var/lib/mysql/*/*.MYI
Recover DB safer mode. You can see logs all status "OK".
[root@eznag log]# mysqlcheck -u nagios -p nagios
Enter password:
nagios.nagios_acknowledgements OK
nagios.nagios_commands OK
nagios.nagios_commenthistory OK
nagios.nagios_comments OK
nagios.nagios_configfiles OK
nagios.nagios_configfilevariables OK
nagios.nagios_conninfo OK
nagios.nagios_contact_addresses OK
nagios.nagios_contact_notificationcommands OK
nagios.nagios_contactgroup_members OK
nagios.nagios_contactgroups OK
nagios.nagios_contactnotificationmethods OK
nagios.nagios_contactnotifications OK
nagios.nagios_contacts OK
nagios.nagios_contactstatus OK
nagios.nagios_customvariables OK
nagios.nagios_customvariablestatus OK
nagios.nagios_dbversion OK
nagios.nagios_downtimehistory OK
nagios.nagios_eventhandlers OK
nagios.nagios_externalcommands OK
nagios.nagios_flappinghistory OK
nagios.nagios_host_contactgroups OK
nagios.nagios_host_contacts OK
nagios.nagios_host_parenthosts OK
nagios.nagios_hostchecks OK
nagios.nagios_hostdependencies OK
nagios.nagios_hostescalation_contactgroups OK
nagios.nagios_hostescalation_contacts OK
nagios.nagios_hostescalations OK
nagios.nagios_hostgroup_members OK
nagios.nagios_hostgroups OK
nagios.nagios_hosts OK
nagios.nagios_hoststatus OK
nagios.nagios_instances OK
nagios.nagios_logentries OK
nagios.nagios_notifications OK
nagios.nagios_objects OK
nagios.nagios_processevents OK
nagios.nagios_programstatus OK
nagios.nagios_runtimevariables OK
nagios.nagios_scheduleddowntime OK
nagios.nagios_service_contactgroups OK
nagios.nagios_service_contacts OK
nagios.nagios_servicechecks OK
nagios.nagios_servicedependencies OK
nagios.nagios_serviceescalation_contactgroups OK
nagios.nagios_serviceescalation_contacts OK
nagios.nagios_serviceescalations OK
nagios.nagios_servicegroup_members OK
nagios.nagios_servicegroups OK
nagios.nagios_services OK
nagios.nagios_servicestatus OK
nagios.nagios_statehistory OK
nagios.nagios_systemcommands OK
nagios.nagios_timedeventqueue OK
nagios.nagios_timedevents OK
nagios.nagios_timeperiod_timeranges OK
nagios.nagios_timeperiods OK
nagios.snmptt OK
nagios.snmptt_archive OK
nagios.snmptt_unknown OK
[root@eznag log]#