Database connection failed SQL

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
james_lin
Posts: 4
Joined: Mon Feb 08, 2016 12:33 pm

Database connection failed SQL

Post by james_lin »

Hi Guys,

We have nagios running for several years. Right now, I got "Database connection failed SQL" error message. I also tried to run "/usr/local/nagiosxi/scripts/repair_databases.sh"; however, it didn't fix the problem.
Please help.

OS: CentOS release 5.6 x64
Nagios XI is manual installed.


Thanks,
James
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Database connection failed SQL

Post by rkennedy »

What version of XI are you running? Can you PM over a profile for us to look at? (Admin -> System Profile -> Download Profile)
Former Nagios Employee
james_lin
Posts: 4
Joined: Mon Feb 08, 2016 12:33 pm

Re: Database connection failed SQL

Post by james_lin »

Hi,

My Nagios Core is 4.1.1
Does it help?

Since my Nagios is down right now, I can't download profile. Could you show me the other way to get profile from command line?

Thanks.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Database connection failed SQL

Post by tgriep »

Can you login to the XI server as root, run the following command and post the output?

Code: Select all

ps -ef
Also, can you post a screen shot of the Web Interface error as well?
Thanks
Be sure to check out our Knowledgebase for helpful articles and solutions!
james_lin
Posts: 4
Joined: Mon Feb 08, 2016 12:33 pm

Re: Database connection failed SQL

Post by james_lin »

Hi,

I attached ps -ef output and screenshot of error message.
Please check it.

Thanks,
James
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Database connection failed SQL

Post by ssax »

First, check the free space:

Code: Select all

df -h
df -i
Then, make sure the DB services are okay.

Check /var/log/mysqld.log and see if you see any crashed tables messages (happening now).

If there are no crashed tables or any other error messages, let's restart the stack:

Code: Select all

service nagios stop
service ndo2db stop
service mysqld restart
service postgresql restart
service httpd restart
service ndo2db start
service nagios start
Did you make any changes? Harden the system, OS updates, XI upgrades, DB password changes, anything? Did it just start happening or did a change cause it?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Database connection failed SQL

Post by Box293 »

Following this KB article should resolve that problem:

https://support.nagios.com/kb/article.php?id=25

Specifically the postgres vacuum.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
james_lin
Posts: 4
Joined: Mon Feb 08, 2016 12:33 pm

Re: Database connection failed SQL

Post by james_lin »

Great!! The problem is on postgres. After I run the code below, my nagios is up and running now.

Code: Select all

service postgresql stop
su postgres
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start
Thanks a lot for your support.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Database connection failed SQL

Post by rkennedy »

Great to hear! Going to mark this one as resolved, and close it up!

Feel free to create a new thread if you need any assistance in the future.
Former Nagios Employee
Locked