Page 1 of 1
Repair database
Posted: Wed Aug 10, 2016 9:38 am
by ednaldojta
Good morning friends!
every time I take the reports, happens to my my Nagios application, lose connection to the database. How can I solve?
Re: Repair database
Posted: Wed Aug 10, 2016 10:44 am
by lmiltchev
What is the version of the Nagios XI that you are currently using? Is MySQL DB local or offloaded to a remote server? Run the following commands, and show the output:
Code: Select all
uname -a
cat /etc/*release
tail -20 /var/log/mysqld.log
If you are using mariadb, run:
Code: Select all
tail -20 /var/log/mariadb/mariadb.log
It seems like you need to repair your database and/or truncate some of the tables (if they are getting too large). Please, review our documentation on the topic here:
https://assets.nagios.com/downloads/nag ... tabase.pdf
Also, see how you can optimize your database settings in Nagios XI here:
https://assets.nagios.com/downloads/nag ... zation.pdf
Re: Repair database
Posted: Wed Aug 10, 2016 11:01 am
by ednaldojta
I'm using Nagios XI 5.2.0 version
Re: Repair database
Posted: Wed Aug 10, 2016 11:07 am
by lmiltchev
Did you repair the DB prior to running the tail command? I don't see any errors/crashed tables in the mysqld.log...
Are you still seeing the DB connection errors in the web UI or your issue has been resolved?
Re: Repair database
Posted: Wed Aug 10, 2016 11:50 am
by ednaldojta
It is always so happens and back normal!
but should this not happen again!
Re: Repair database
Posted: Wed Aug 10, 2016 11:55 am
by lmiltchev
Database corruption is usually caused by power outages, running out of disk space or improper shutting down the Nagios XI server.
Many times users would right-click on the Nagios XI VM in VMWare Workstation/ESXi/Vsphere and select "Power Off". This is wrong - it is like pulling off the power cord. The correct way for shutting down the Nagios XI server would be to issue the following command in the command line:
How much room do you have on the hard drive? Run the following commands and show the output:
Re: Repair database
Posted: Wed Aug 10, 2016 12:42 pm
by ednaldojta
To turn off, I use the command line.
Not now this happens! And only happens when I do the extraction of reports.
Re: Repair database
Posted: Wed Aug 10, 2016 2:51 pm
by tgriep
It could be that your server is off-loaded to a remote server and the repair script isn't fixing the corruption.
Can you login to the XI server as root, run the following and post the output? This will tell us is the server is local or not.
Code: Select all
grep dbserver /usr/local/nagiosxi/html/config.inc.php
Another thing is could be the Max Connections to the mysql database needs to be increased. Take a look at this article to do that.
https://support.nagios.com/kb/article.php?id=513
Re: Repair database
Posted: Thu Aug 11, 2016 8:24 am
by ednaldojta
My bank is local.
Re: Repair database
Posted: Thu Aug 11, 2016 9:11 am
by tgriep
What report are you running to cause the SQL database corruption?
Did you follow the KB article that I posted and did you try to run the report again to see if that fixes the issue?