A database connection error has been detected

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
pfsweb
Posts: 47
Joined: Fri Jun 27, 2014 9:01 am

A database connection error has been detected

Post by pfsweb »

Message: A database connection error has been detected, we are attempting to repair the server, if the repair does not resolve the issue, please contact Nagios support.

Run the following from the CLI as root to attempt to repair the DB

/usr/local/nagiosxi/scripts/repair_databases.sh

Tried running this script, no change. Also tried restarting both the database and nagiosxi servers

output from /var/log/httpd/error_log
[Sun Jul 12 14:59:27 2015] [error] [client 10.x.x.x] PHP Warning: pg_pconnect(): Unable to connect to PostgreSQL server: FATAL: connection limit exceeded for non-superusers in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682, referer: http://nagiosxi.address.com/nagiosxi/
[Sun Jul 12 14:59:27 2015] [error] [client 10.x.x.x] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241, referer: http://nagiosxi.address.com/nagiosxi/
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: A database connection error has been detected

Post by Box293 »

Is postgresql running?

Code: Select all

service postgresql status
The logs are named by the day, , for example postgresql-Mon.log
Can you please run this command for the most recent log:

Code: Select all

tail -n 100 /var/lib/pgsql/data/pg_log/postgresql-Mon.log
And also:

Code: Select all

tail /var/log/messages -n 100
Post the results here in a code block.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pfsweb
Posts: 47
Joined: Fri Jun 27, 2014 9:01 am

Re: A database connection error has been detected

Post by pfsweb »

Was this ever resolved? I'm actually having the same issue.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: A database connection error has been detected

Post by hsmith »

I think that is a question that only the original author of the topic can answer. ;)

Have these steps been done?
Box293 wrote:Is postgresql running?

Code: Select all

service postgresql status
The logs are named by the day, , for example postgresql-Mon.log
Can you please run this command for the most recent log:

Code: Select all

tail -n 100 /var/lib/pgsql/data/pg_log/postgresql-Mon.log
And also:

Code: Select all

tail /var/log/messages -n 100
Post the results here in a code block.
Former Nagios Employee.
me.
pfsweb
Posts: 47
Joined: Fri Jun 27, 2014 9:01 am

Re: A database connection error has been detected

Post by pfsweb »

# service postgresql status
postmaster (pid 1914) is running...


# tail -n 100 /var/lib/pgsql/data/pg_log/postgresql-Mon.log
FATAL: connection limit exceeded for non-superusers
FATAL: connection limit exceeded for non-superusers
FATAL: connection limit exceeded for non-superusers
FATAL: connection limit exceeded for non-superusers
FATAL: connection limit exceeded for non-superusers
FATAL: connection limit exceeded for non-superusers
FATAL: connection limit exceeded for non-superusers
FATAL: connection limit exceeded for non-superusers
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: A database connection error has been detected

Post by lmiltchev »

Have you tried increasing the default "max_connections" value of 100 in the "/var/lib/pgsql/data/postgresql.conf", i.e.

Code: Select all

max_connections = 200
and restarting the posgresql?

Code: Select all

service postgresql restart
Be sure to check out our Knowledgebase for helpful articles and solutions!
pfsweb
Posts: 47
Joined: Fri Jun 27, 2014 9:01 am

Re: A database connection error has been detected

Post by pfsweb »

I did some research on the error message after I posted the results and found I could increase the limit. I have done so only a few minutes ago. I haven't seen any DB Connection errors since but it may be too early to tell.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: A database connection error has been detected

Post by jdalrymple »

We'll leave the ticket open. Reach back out if the problem recurs.
Locked