DB Connect Error [nagiosxi]: Database connection failed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
cyient
Posts: 116
Joined: Thu May 08, 2014 4:45 am

DB Connect Error [nagiosxi]: Database connection failed

Post by cyient »

Hi Team,

I have issue with Nagios XI server which is throwing below error.

DB Connect Error [nagiosxi]: Database connection failed

I see that the https, nagios and msql services are up and running.

Can you help me out in this regard ?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by tgriep »

If you are running an older version of Nagios XI, the nagiosxi database was hosted by the Postgres database so try running this to see if that fixes the issue.

Code: Select all

service postgresql restart
If that doesn't work, run the following in a shell on the Nagios server and that will tell us which database the server is using.
Please post the output.

Code: Select all

grep dbtype /usr/local/nagiosxi/html/config.inc.php
Be sure to check out our Knowledgebase for helpful articles and solutions!
cyient
Posts: 116
Joined: Thu May 08, 2014 4:45 am

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by cyient »

Hi,

Thanks for the reply.

I have restarted postgresql service and it work like a charm, but i see all the services and hosts have vanished and it showed me the Installation page after fresh install of Nagios XI :o
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by dwhitfield »

Quickest thing might be to restore from backup. Can you pm me your profile and the output of your history command? There might be a clue there. After you pm you must respond to this thread for it to come back up on our support dashboard.
cyient
Posts: 116
Joined: Thu May 08, 2014 4:45 am

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by cyient »

dwhitfield wrote:Quickest thing might be to restore from backup. Can you pm me your profile and the output of your history command? There might be a clue there. After you pm you must respond to this thread for it to come back up on our support dashboard.
Hi,

I haved PMed the files.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by dwhitfield »

I got the history, but not the profile. Can you try that again? Thanks!
cyient
Posts: 116
Joined: Thu May 08, 2014 4:45 am

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by cyient »

Hi,

When i'm trying to restore backup from another server, i got hang while restoring MySQL backup.


When i have stopped the script got the error message as

Code: Select all

Restoring MySQL databases...
^CCtrl-C -- sending "KILL QUERY 283235" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100) at line 22: Query execution was interrupted
Error restoring MySQL database 'nagios' - check the password in this script!
When i have manually logged in using the default password able to login.

Please find the screenshot and suggest on how to move on.
You do not have the required permissions to view the files attached to this post.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by dwhitfield »

Please post your /etc/my.cnf

Also, what's the output of the two following commands:

Code: Select all

df -i
df -h
How long did you wait? If the backup is large, it could take a while.

How many hosts and services were you monitoring?

Does the CCM show the same amount of hosts/services as the Summary page? Those are actually in the nagiosql and nagios databases, not the nagiosxi database.

Are you able to log into all of the databases locally? The default password for root is nagiosxi, if you are not sure if you changed the passwords.
cyient
Posts: 116
Joined: Thu May 08, 2014 4:45 am

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by cyient »

Please find the output of /etc/my.cnf

Code: Select all

 cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
df -i & df -h

Code: Select all

[root@Nagios ~]# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      632736  117498  515238   19% /
tmpfs                 220357       1  220356    1% /dev/shm
/dev/sda1              25688      38   25650    1% /boot
[root@Nagios ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      9.5G  5.5G  3.6G  61% /
tmpfs                1012M     0 1012M   0% /dev/shm
/dev/sda1              97M   21M   72M  23% /boot
[root@Nagios ~]#
We are monitoring only two hosts and around 7 services that's it.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by dwhitfield »

cyient wrote: services and hosts have vanished
I may not have been clear in my inquiry. If 2 hosts and 7 services vanished, why don't you just add them back? What I'm trying to get at is how large is your backup. Did you have any backups from further back you tried?


How long did you wait for the mysql backup to restore? I'm also a bit confused because you gave a screenshot without an error message but then gave an error message in the text. Please try to be as precise as possible when giving the order and timing of events.
Locked