Page 1 of 1

DB Connections Failing when attempting to view Web Interface

Posted: Mon May 19, 2014 9:30 am
We receive the following errors when I attempt to access the web interface.

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


What version of Nagios XI are you using? Nagios XI 2012R2.5
Linux Distribution and version? CentOS release 5.4
32 or 64bit? 32 bit
VMware Image or Manual Install of XI? vmware image

It started issuing this error, so I rebooted the box cleanly from the guest O/S. (shutdown -ry 0). Error keeps occurring. I checked to ensure that we have plenty of free space/free inodes.


[root@incentive ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
33G 7.6G 24G 25% /
/dev/sda1 99M 18M 76M 20% /boot
tmpfs 1.5G 0 1.5G 0% /dev/shm
/dev/mapper/nagiosVolGRP-nagiosLV
40G 16G 22G 43% /nagios
[root@incentive ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/VolGroup00-LogVol00
8880128 95188 8784940 2% /
/dev/sda1 26104 41 26063 1% /boot
tmpfs 219864 1 219863 1% /dev/shm
/dev/mapper/nagiosVolGRP-nagiosLV
5232640 920 5231720 1% /nagios

Also checked the $PATH variable.

[nagios@incentive root]$ echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@incentive ~]#

Any help would be appreciated.

Re: DB Connections Failing when attempting to view Web Inter

Posted: Mon May 19, 2014 11:27 am
by lmiltchev
Is postgresql running?

Code: Select all

service postgresql status
Try restarting it:

Code: Select all

service postgresql restart
service postgresql status
See if you can log in postgres:

Code: Select all

psql nagiosxi nagiosxi
You may need to vacuum the postgres. Run the following command in terminal:

Code: Select all

echo "vacuum;vacuum analyze;vacuum full;"|psql nagiosxi postgres
Let me know if this helped.

Re: DB Connections Failing when attempting to view Web Inter

Posted: Tue May 20, 2014 9:57 am
[root@incentive ~]# service postgresql status
postmaster (pid 1197 1196 1195 1193 1132) is running...
[root@incentive ~]# service postgresql restart
Stopping postgresql service: [ OK ]
Starting postgresql service: [ OK ]
[root@incentive ~]# service postgresql status
postmaster (pid 9720 9719 9718 9715 9713) is running...
[root@incentive ~]# psql nagiosxi nagiosxi
psql: FATAL: database is not accepting commands to avoid wraparound data loss in database "postgres"
HINT: Stop the postmaster and use a standalone backend to vacuum database "postgres".
[root@incentive ~]# echo "vacuum;vacuum analyze;vacuum full;"|psql nagiosxi postgres
psql: FATAL: database is not accepting commands to avoid wraparound data loss in database "postgres"
HINT: Stop the postmaster and use a standalone backend to vacuum database "postgres".
[root@incentive ~]#

Re: DB Connections Failing when attempting to view Web Inter

Posted: Tue May 20, 2014 10:20 am
by lmiltchev
It seems like you need to run the vacuum in a "standalone" mode. You may try running the following commands:

Code: Select all

service postgresql stop
su postgres
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data postgres < /tmp/fix.sql
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start
Let me know if this fixed your issue.

Re: DB Connections Failing when attempting to view Web Inter

Posted: Fri May 23, 2014 10:20 am
It did resolve the issue - thanks for the help! Please close this case.