Nagios XI database was not setup properly error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Nagios XI database was not setup properly error

Post by Berto »

Hello,

I'm getting an error when i run the ./fullinstall script for Nagios XI. The server was built with a fresh installation of Red Hat 6.6 and when the script gets to creating role and database it displays the following errors:

Sorry, user root is not allowed to execute '/usr/bin/psql -c create user nagiosxi with password 'n@gweb';' as postgres on <hostname>
Sorry, user root is not allowed to execute '/usr/bin/psql -c create database nagiosxi owner nagiosxi;' as postgres on <hostname>

As the script needs to be ran as root, how do I continue on with the installation and/or running script as it seems that root isn't allowed to execute /usr/bin/psql?

Thanks,

Berto
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios XI database was not setup properly error

Post by ssax »

Please attach your /var/lib/pgsql/data/pg_hba.conf so that we may look at the permissions.
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Re: Nagios XI database was not setup properly error

Post by Berto »

I have uploaded the config file that has been requested.
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios XI database was not setup properly error

Post by lmiltchev »

Is postgresql running at the moment? Can you restart it? Run the following commands and show us the output in code wraps:

Code: Select all

service postgresql status
service postgresql restart
service postgresql status
cat /var/lib/pgsql/pgstartup.log
cat /var/lib/pgsql/data/pg_log/postgresql-Wed.log
Be sure to check out our Knowledgebase for helpful articles and solutions!
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Re: Nagios XI database was not setup properly error

Post by Berto »

Here is the output of each command that was requested to run.

Code: Select all

[root~]# service postgresql status
postmaster (pid  16465) is running...
[root~]# service postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]
[root~]# service postgresql status
postmaster (pid  48323) is running...

[root~]# cat /var/lib/pgsql/pgstartup.log
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

Success. You can now start the database server using:
/usr/bin/postgres -D /var/lib/pgsql/data
or
/usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 15876) running in data directory "/var/lib/pgsql/data"?
FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 15876) running in data directory "/var/lib/pgsql/data"?

[root~]# cat /var/lib/pgsql/data/pg_log/postgresql-Thu.log 
LOG:  received fast shutdown request
LOG:  aborting any active transactions
LOG:  autovacuum launcher shutting down
LOG:  shutting down
LOG:  database system is shut down
LOG:  database system was shut down at 2015-07-30 15:44:50 EDT
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios XI database was not setup properly error

Post by ssax »

Please post the output of this command:

Code: Select all

ps ax | grep pgsql
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Re: Nagios XI database was not setup properly error

Post by Berto »

Here is the requested output

[root@lnsvr0615 ~]# ps ax | grep pqsql
743 pts/0 S+ 0:00 grep pqsql
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios XI database was not setup properly error

Post by tmcdonald »

Let's check that directory:

Code: Select all

ls -l /var/lib/pgsql/data
Former Nagios employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios XI database was not setup properly error

Post by lmiltchev »

Run the following command instead:

Code: Select all

ps -ef | grep postmaster
If postgresql is running, try rerunning the fullinstall script.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Re: Nagios XI database was not setup properly error

Post by Berto »

Here is the output.

[root@lnsvr0615 nagiosxi]# ls -l /var/lib/pgsql/data
total 80
drwx------ 5 postgres postgres 4096 Jul 25 14:01 base
drwx------ 2 postgres postgres 4096 Jul 30 15:44 global
drwx------ 2 postgres postgres 4096 Jul 25 14:01 pg_clog
-rw------- 1 postgres postgres 3358 Jul 27 18:11 pg_hba.conf
-rw------- 1 postgres postgres 1631 Jul 25 14:01 pg_ident.conf
drwx------ 2 postgres postgres 4096 Jul 31 00:00 pg_log
drwx------ 4 postgres postgres 4096 Jul 25 14:01 pg_multixact
drwx------ 2 postgres postgres 4096 Aug 3 09:00 pg_stat_tmp
drwx------ 2 postgres postgres 4096 Jul 25 14:01 pg_subtrans
drwx------ 2 postgres postgres 4096 Jul 25 14:01 pg_tblspc
drwx------ 2 postgres postgres 4096 Jul 25 14:01 pg_twophase
-rw------- 1 postgres postgres 4 Jul 25 14:01 PG_VERSION
drwx------ 3 postgres postgres 4096 Jul 25 14:01 pg_xlog
-rw------- 1 postgres postgres 16886 Jul 25 14:01 postgresql.conf
-rw------- 1 postgres postgres 57 Jul 30 15:44 postmaster.opts
-rw------- 1 postgres postgres 46 Jul 30 15:44 postmaster.pid

root@lnsvr0615 nagiosxi]# ps -ef | grep postmaster
postgres 48323 1 0 Jul30 ? 00:00:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data
root 61917 61285 0 09:01 pts/0 00:00:00 grep postmaster

I rerun the fullinstall script and I still get

Checking PostgresQL status...
PostgresQL running - continuing...
Creating role and database...
Sorry, user root is not allowed to execute '/usr/bin/psql -c create user nagiosxi with password 'n@gweb';' as postgres on lnsvr0615.
Sorry, user root is not allowed to execute '/usr/bin/psql -c create database nagiosxi owner nagiosxi;' as postgres on lnsvr0615.
ERROR: Nagios XI database was not setup properly - exiting.
RESULT=1
Locked