postgresql fail to start

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
david_sloboda
Posts: 33
Joined: Mon Apr 30, 2012 1:26 pm
Location: Burnaby, Canada

postgresql fail to start

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: postgresql fail to start

Post by slansing »

Please run through the vacuum steps here:

http://support.nagios.com/wiki/index.ph ... .22_in_log
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: postgresql fail to start

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
david_sloboda
Posts: 33
Joined: Mon Apr 30, 2012 1:26 pm
Location: Burnaby, Canada

Re: postgresql fail to start

Post by david_sloboda »

[root@bby1nms01 ~]# psql --version
psql (PostgreSQL) 8.1.23
contains support for command-line editing
[root@bby1nms01 ~]#
david_sloboda
Posts: 33
Joined: Mon Apr 30, 2012 1:26 pm
Location: Burnaby, Canada

Re: postgresql fail to start

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: postgresql fail to start

Post 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."
david_sloboda
Posts: 33
Joined: Mon Apr 30, 2012 1:26 pm
Location: Burnaby, Canada

Re: postgresql fail to start

Post 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
david_sloboda
Posts: 33
Joined: Mon Apr 30, 2012 1:26 pm
Location: Burnaby, Canada

Re: postgresql fail to start

Post 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
Locked