Page 1 of 2

DB Connect Error [nagiosxi]: Database connection failed

Posted: Fri Dec 09, 2011 4:35 pm
by jladd
Nagios XI manual install
Centos6
32bit

So far I have read the posts on this error and tried the fixes and so far nothing seems to fix my issue. Also when i try to restart the postgresql service it fails to start. httpd restarts without issues though.

looking in /var/lib/pgsql/data/pg_log I am seeing over and over


ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;

and

Code: Select all

LOG:  database system was interrupted; last known up at 2011-12-08 00:38:41 EST
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  redo starts at 0/8F69ACE8
LOG:  record with zero length at 0/8F6C2EA0
LOG:  redo done at 0/8F6C2E70
LOG:  last completed transaction was at log time 2011-12-08 00:43:02.649566-05
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
LOG:  database system was interrupted; last known up at 2011-12-08 01:39:17 EST
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  redo starts at 0/8F8C5E90
LOG:  record with zero length at 0/8F8EA0F8
LOG:  redo done at 0/8F8EA0C8
LOG:  last completed transaction was at log time 2011-12-08 01:43:38.181575-05
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

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

Posted: Sat Dec 10, 2011 8:04 am
by jladd
Also I am straight command line on this install no GUI so I don't have gnome installed and am definitely not out of drive space I have 2x 1TB drives in raid -1 and have a lot of free space.
df output.

Code: Select all

[root@nagios ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_nagios-lv_root
                      51606140   3150004  45834696   7% /
tmpfs                  1535124         0   1535124   0% /dev/shm
/dev/md127p1            495844     49508    420736  11% /boot
/dev/mapper/vg_nagios-lv_home
                     904223832    204760 858087144   1% /home
Any ideas or anything I can do that might help trouble shoot this issue any kind of log file I should look in for errors?

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

Posted: Mon Dec 12, 2011 1:08 pm
by mguthrie
I would start by restarting the server. Then from there I would run the following:

Code: Select all

cd /usr/local/nagiosxi/tools
./fix_postgres_sequences.sh

psql nagiosxi nagiosxi
vacuum;
vacuum analyze;
vacuum full;
\q

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

Posted: Mon Dec 12, 2011 2:58 pm
by jladd
when trying to login to psql

Code: Select all

 psql nagiosxi nagiosxi
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

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

Posted: Mon Dec 12, 2011 4:12 pm
by mguthrie
Hmm, is postgresql running at all?

Code: Select all

service postgresql restart

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

Posted: Mon Dec 12, 2011 5:45 pm
by jladd
[root@nagios ~]# service postgresql restart
Stopping postgresql service: [ OK ]
Starting postgresql service: [FAILED]
[root@nagios ~]#

I don't know if this helps but in the /var/lib/pgsql/pgstartup.log

Code: Select all

LOG:  could not translate host name "localhost", service "5432" to address: Name or service not known
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets
LOG:  could not translate host name "localhost", service "5432" to address: Name or service not known
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets
LOG:  could not translate host name "localhost", service "5432" to address: Name or service not known
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets
LOG:  could not translate host name "localhost", service "5432" to address: Name or service not known
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets

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

Posted: Tue Dec 13, 2011 12:50 pm
by mguthrie
Have you made any recent firewall changes or system changes recently that might point to a cause of this? Is this machine able to correctly resolve to localhost? It looks like it might not be...
32" to address: Name or service not known
WARNING: could not create listen socket for "localhost"

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

Posted: Tue Dec 13, 2011 1:00 pm
by jladd
I was having issues with FQDNS before and I tried to modify /etc/hosts changed it to

127.0.0.1 nagios.localdomain.com
::1

other than that nothing.

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

Posted: Tue Dec 13, 2011 3:28 pm
by jladd
ok so I fixed the hosts/fqdn issue I was having which allows me to log back in and use nagios. But all of the hosts and services are gone from nagiosxi but everything seems to still be intact in nagioscore.

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

Posted: Tue Dec 13, 2011 4:02 pm
by mguthrie
There's probably still a host name issue with mysql. Can you check the apache log for info:

Code: Select all

tail -f /var/log/httpd/error_log