Page 1 of 1
DB Connect Error [nagiosxi]: Database connection failed
Posted: Thu Apr 20, 2017 2:25 am
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 ?
Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Thu Apr 20, 2017 1:30 pm
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.
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
Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Thu Apr 20, 2017 11:54 pm
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

Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Fri Apr 21, 2017 8:14 am
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.
Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Wed Apr 26, 2017 5:22 am
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.
Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Wed Apr 26, 2017 8:39 am
by dwhitfield
I got the history, but not the profile. Can you try that again? Thanks!
Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Tue May 02, 2017 7:45 am
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.
Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Tue May 02, 2017 11:34 am
by dwhitfield
Please post your /etc/my.cnf
Also, what's the output of the two following commands:
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.
Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Wed May 03, 2017 12:00 am
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.
Re: DB Connect Error [nagiosxi]: Database connection failed
Posted: Wed May 03, 2017 10:52 am
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.