Error restoring PostgresQL database 'nagiosxi... Please help

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
dbsaust
Posts: 76
Joined: Mon Dec 06, 2010 12:41 am

Error restoring PostgresQL database 'nagiosxi... Please help

Post by dbsaust »

Hi All,
We are trying to restore Nagios XI 5.2.2 version:
- Source system is 32 bit, Cent OS 5
- Destination system is 64 bit Cent OX 7
- Installed Nagios XI 5.2.2 on destination VM and then run the restoration script. Haven't installed anything except WGET on the new VM destination. But restore script is complaining about PostgresQL.

- Screen shot logs as below. What to do? Kindly assist.

Log:

Code: Select all

[root@newnagiosxi nagiosxi]# /usr/local/nagiosxi/scripts/restore_xi.sh  /store/backups/nagiosxi/1505986286.tar.gz
WARNING: you are trying to restore a i386 backup on a x86_64 system
         Compiled plugins and other binaries will NOT be restored.

Are you sure you want to continue? [y/N] y
WARNING: you are trying to restore a OS 5 backup on a OS 7 system
         Compiled plugins and other binaries as well as httpd configurations
         will NOT be restored.

Are you sure you want to continue? [y/N] y
TS=1506241895
Extracting backup to /store/backups/nagiosxi/1506241895-restore...
In /store/backups/nagiosxi/1506241895-restore/1505986286...
Backup files look okay.  Preparing to restore...
Shutting down services...
Restoring directories to /...
Restoring Nagios Core...
Restoring Nagios XI...
Restoring NagiosQL...
Restoring NagiosQL backups...
Restoring NRDP backups...
Restoring MRTG...
Restoring Nagvis backups...
chown: cannot access â/usr/local/nagvisâ: No such file or directory
Restoring MySQL databases...
Redirecting to /bin/systemctl start  postgresql.service
Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.
Restoring Nagios XI PostgresQL database...
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Error restoring PostgresQL database 'nagiosxi' !
You have new mail in /var/spool/mail/root
Last edited by dbsaust on Sat Nov 11, 2017 12:39 am, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by scottwilkerson »

you will need to also have postgres installed to restore a version that was running postgres

Code: Select all

yum install postgresql postgresql-devel postgresql-libs postgresql-server php-pgsql -y
Then perform the restore

Once the restore is complete, being you are changing arch, you will want to see this document as well
https://support.nagios.com/kb/article/n ... -data.html
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
dbsaust
Posts: 76
Joined: Mon Dec 06, 2010 12:41 am

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by dbsaust »

Thanks scottwilkerson!
I will try tonight and update you here.
dbsaust
Posts: 76
Joined: Mon Dec 06, 2010 12:41 am

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by dbsaust »

Hi scottwilkerson,
PostgreSQL is now running okay. However, this time complaining the below:

psql: FATAL: Peer authentication failed for user "nagiosxi"

Code: Select all

Extracting backup to /store/backups/nagiosxi/1506421212-restore...
In /store/backups/nagiosxi/1506421212-restore/1505986286...
Backup files look okay.  Preparing to restore...
Shutting down services...
Restoring directories to /...
Restoring Nagios Core...
Restoring Nagios XI...
Restoring NagiosQL...
Restoring NagiosQL backups...
Restoring NRDP backups...
Restoring MRTG...
Restoring Nagvis backups...
chown: cannot access â/usr/local/nagvisâ: No such file or directory
Restoring MySQL databases...
Redirecting to /bin/systemctl start  postgresql.service
Restoring Nagios XI PostgresQL database...
psql: FATAL:  Peer authentication failed for user "nagiosxi"
Error restoring PostgresQL database 'nagiosxi' !
Last edited by dbsaust on Sat Nov 11, 2017 12:38 am, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by scottwilkerson »

Sorry, you will also need to so the following:

Code: Select all

psql -c "create user nagiosxi with password 'n@gweb';"
psql -c "create database nagiosxi owner nagiosxi;"
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
dbsaust
Posts: 76
Joined: Mon Dec 06, 2010 12:41 am

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by dbsaust »

Thanks again, scottwilkerson!

I tried the following which were successful. Will give it a go tonight and will update here.

Code: Select all

[root@newnagiosxi ~]# su - postgres
Last login: Tue Sep 26 21:09:45 AEST 2017 on pts/0
-bash-4.2$ psql -c "create user nagiosxi with password 'n@gweb';"
CREATE ROLE
-bash-4.2$ psql -c "create database nagiosxi owner nagiosxi;"
CREATE DATABASE
-bash-4.2$ exit
logout
Last edited by dbsaust on Sat Nov 11, 2017 12:38 am, edited 1 time in total.
dbsaust
Posts: 76
Joined: Mon Dec 06, 2010 12:41 am

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by dbsaust »

Hi scottwilkerson,
Still following error. Kindly assist.

Restoring Nagios XI PostgresQL database...
psql: FATAL: Peer authentication failed for user "nagiosxi"
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by tgriep »

There is a Postgres configuration file that needs to be configures to allow access to the database and the default settings maybe blocking the restore.
Edit the following file on the new server.

Code: Select all

/var/lib/pgsql/data/pg_hba.conf
Comment out all of the settings at the bottom of the file and add the following if they do not exist.

Code: Select all

local   all         all                               trust
host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust
Save the file and restart postgres by running

Code: Select all

service postgresql restart
Then try the restore again and see if this resolves the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dbsaust
Posts: 76
Joined: Mon Dec 06, 2010 12:41 am

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by dbsaust »

Hi tgriep,
Modified following lines and restart the service as per your direction. Will try again tonight and inform you the outcome. Thanks.

Code: Select all

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
dbsaust
Posts: 76
Joined: Mon Dec 06, 2010 12:41 am

Re: Error restoring PostgresQL database 'nagiosxi... Please

Post by dbsaust »

Hi tgriep,
Yes, restoration completed and I can login Nagios XI pages using an existing user. Thank you very much!
By the way, after restoration, as documented, I applied the follwoing commands:

Code: Select all

cd /tmp/nagiosxi
rm -f installed.subcomponents
./A-subcomponents

The above gave error on MySQL though, but pages still working. Do I need to re-run above commands?

Additionally, we are migrating from a 32bit to 64bit machine and I understand that we need to convert the performance data. Is it mandatory now?

Thanks mate.
Locked