Page 1 of 1

postgresql fail to start

Posted: Mon Dec 02, 2013 3:01 pm
by david_sloboda
I am not able to start postgresql.

I am getting the same error as this post
http://support.nagios.com/forum/viewtop ... postgresql

The web browser GUI shows this error:
DB Connect Error [nagiosxi]: Database connection failed DB Connect Error [nagiosxi]: Database connection failed

From the command line I cannot start postgresql

[root@bby1nms01 ~]# service postgresql start
Starting postgresql service: [FAILED]
[root@bby1nms01 ~]#

I have checked both disk space and disk inode usage.
Neither are full.
There are both free inodes and free disk space.

I am looking for the postgresql logs to further troubleshoot this.

Thank you for your time and feedback.

Re: postgresql fail to start

Posted: Mon Dec 02, 2013 3:05 pm
by slansing
Please run through the vacuum steps here:

http://support.nagios.com/wiki/index.ph ... .22_in_log

Re: postgresql fail to start

Posted: Mon Dec 02, 2013 3:07 pm
by lmiltchev
What is the version of postgres that you are using?

Code: Select all

psql --version
Can you run the following command successfully, or you are getting an error?

Code: Select all

echo "vacuum;vacuum analyze;vacuum full;"|psql nagiosxi postgres

Re: postgresql fail to start

Posted: Mon Dec 02, 2013 3:51 pm
by david_sloboda
[root@bby1nms01 ~]# psql --version
psql (PostgreSQL) 8.1.23
contains support for command-line editing
[root@bby1nms01 ~]#

Re: postgresql fail to start

Posted: Mon Dec 02, 2013 3:54 pm
by david_sloboda
Thanks for your response
this command
http://support.nagios.com/wiki/index.ph ... .22_in_log
fails to start because postgresql is not running and cannot start

[root@bby1nms01 ~]# service postgresql start
Starting postgresql service: [FAILED]
[root@bby1nms01 ~]# 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"?
[root@bby1nms01 ~]#

[root@bby1nms01 ~]# echo "vacuum;vacuum analyse;vacuum full;"|psql nagiosxi postgres
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"?
[root@bby1nms01 ~]#

I am running
Nagios XI 2012R2.2

Re: postgresql fail to start

Posted: Mon Dec 02, 2013 3:58 pm
by slansing
Lets go through a simple XI upgrade, this may resolve the issue:

http://assets.nagios.com/downloads/nagi ... ctions.pdf

Then log out of the web interface, check to see if postgres is running:

Code: Select all

service postgresql status
and log back in "then follow the completing upgrade steps in the interface."

Re: postgresql fail to start

Posted: Mon Dec 02, 2013 4:24 pm
by david_sloboda
The upgrade is failing because the postgresql database will not start.

How do I
a) start the postgresql database,
then
b) re-run the upgrade?

[root@bby1nms01 tmp]# tar xzf xi-2012r2.7.tar.gz
[root@bby1nms01 tmp]# cd /tmp/nagiosxi/
[root@bby1nms01 nagiosxi]# ./upgrade
...
Patching NDOUtils...
PHP Warning: pg_pconnect(): Unable to connect to PostgreSQL server: could not connect to server: Connection timed out
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
DB Connect Error [nagiosxi]: Database connection failed
ERROR CONNECTING TO DATABASES!
...

Thank you,
David Sloboda

Re: postgresql fail to start

Posted: Mon Dec 02, 2013 4:39 pm
by david_sloboda
I found the error by finding /var/lib/pgsql/pgstartup.log

The entry for localhost was redefined on this server which caused the error.

Now that localhost is defined correctly,
postgresql has started
and the upgrade has completed.

[root@bby1nms01 nagiosxi]# service postgresql start
Starting postgresql service: [ OK ]
[root@bby1nms01 nagiosxi]#

Thank you for your time.
David Sloboda