Re: mysqld: Table is crashed and last (automatic?) repair
Posted: Thu Dec 17, 2020 10:14 am
Thanks for the files.
What I see is that the MYSQL database was stopped and started while the nagios and the ndo2db services were running and that causes corruption to the database.
If you ever have to do any maintenance to the MYSQL database like restarting it, stop the nagios, ndo2db, crond services first and that should stop the corruption from happening.
The notifications table is so corrupted, you cannot describe the table settings so we will have to truncate it.
Run the following to stop the processes, repair and truncate the database and then start the process again.
As soon as you are done with the above, run this as root and post the output here so I can see if the notifications table settings look correct.
What I see is that the MYSQL database was stopped and started while the nagios and the ndo2db services were running and that causes corruption to the database.
If you ever have to do any maintenance to the MYSQL database like restarting it, stop the nagios, ndo2db, crond services first and that should stop the corruption from happening.
The notifications table is so corrupted, you cannot describe the table settings so we will have to truncate it.
Run the following to stop the processes, repair and truncate the database and then start the process again.
Code: Select all
systemctl stop npcd
systemctl stop nagios
systemctl stop ndo2db
systemctl stop crond
pkill -9 -u nagios
echo "truncate table xi_events; truncate table xi_meta; truncate table xi_eventqueue;" | mysql -u root -pnagiosxi nagiosxi
echo "truncate table nagios_notifications;" | mysql -u root -pnagiosxi nagios
mysqlcheck -f -r -u root -pnagiosxi --all-databases --use-frm
mysqlcheck -f -o -u root -pnagiosxi --databases nagios
systemctl restart mariadb
rm -f /usr/local/nagios/var/rw/nagios.cmd
rm -f /usr/local/nagios/var/nagios.lock
rm -f /var/run/nagios.lock
rm -f /usr/local/nagios/var/ndo.sock
rm -f /usr/local/nagios/var/ndo2db.lock
rm -f /var/lib/mrtg/mrtg_l
rm -f /usr/local/nagiosxi/var/*.lock
rm -f /usr/local/nagiosxi/tmp/*.lock
for i in `ipcs -q | grep nagios |awk '{print $2}'`; do ipcrm -q $i; done
pkill python
systemctl restart httpd
systemctl start ndo2db
systemctl start nagios
systemctl start npcd
systemctl start crondAs soon as you are done with the above, run this as root and post the output here so I can see if the notifications table settings look correct.
Code: Select all
echo 'desc nagios_notifications;' |mysql -t -u root -pnagiosxi nagios