Page 1 of 1

Nagios Restoration to CentOS 7 from CentOS 5 backup

Posted: Wed Nov 08, 2017 9:22 pm
by dbsaust
Hi All,
We are migrating Nagios XI from CentOS 5 (32 bit) to CentOS 7 (64 bit). Same Nagios XI version 5.2.2 was installed on new VM and took a back up from the old one. However, after restoration, when tried to access Nagios XI from WEB, received following error:

Message: A database connection error has been detected, we are attempting to repair the server, if the repair does not resolve the issue, please contact Nagios support.

Run the following from the CLI as root to attempt to repair the DB

/usr/local/nagiosxi/scripts/repair_databases.sh


Restoration Log, below:
====================

Code: Select all

[root@newnagiosxi nagiosxi]# /usr/local/nagiosxi/scripts/restore_xi.sh /store/backups/nagiosxi/1510191513.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=1510192400
Extracting backup to /store/backups/nagiosxi/1510192400-restore...
In /store/backups/nagiosxi/1510192400-restore/1510191513...
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...
SET
SET
SET
SET
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
DROP INDEX
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
DROP TABLE
DROP SEQUENCE
DROP TABLE
DROP SEQUENCE
DROP TABLE
DROP SEQUENCE
DROP TABLE
DROP SEQUENCE
DROP TABLE
DROP SEQUENCE
DROP TABLE
DROP SEQUENCE
DROP TABLE
DROP SEQUENCE
DROP TABLE
DROP SEQUENCE
DROP SEQUENCE
DROP SEQUENCE
DROP SEQUENCE
DROP SEQUENCE
DROP SEQUENCE
ERROR:  must be owner of schema public
ERROR:  schema "public" already exists
ALTER SCHEMA
ERROR:  must be owner of schema public
CREATE SEQUENCE
ALTER TABLE
 setval
--------
     20
(1 row)

CREATE SEQUENCE
ALTER TABLE
 setval
--------
     16
(1 row)

CREATE SEQUENCE
ALTER TABLE
 setval
--------
     25
(1 row)

CREATE SEQUENCE
ALTER TABLE
 setval
--------
     15
(1 row)

CREATE SEQUENCE
ALTER TABLE
 setval
--------
     14
(1 row)

CREATE SEQUENCE
ALTER TABLE
 setval
--------
    142
(1 row)

SET
SET
CREATE TABLE
ALTER TABLE
 setval
--------
  88210
(1 row)

CREATE SEQUENCE
ALTER TABLE
 setval
--------
  34733
(1 row)

CREATE TABLE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
 setval
---------
 3549421
(1 row)

CREATE TABLE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
 setval
---------
 3548535
(1 row)

CREATE TABLE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
 setval
--------
    155
(1 row)

CREATE TABLE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
 setval
--------
     99
(1 row)

CREATE TABLE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
 setval
--------
   6782
(1 row)

CREATE TABLE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
 setval
--------
    168
(1 row)

CREATE TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
WARNING:  no privileges could be revoked for "public"
REVOKE
WARNING:  no privileges could be revoked for "public"
REVOKE
WARNING:  no privileges were granted for "public"
GRANT
WARNING:  no privileges were granted for "public"
GRANT
/usr/local/nagiosxi/scripts/restore_xi.sh: line 232: DROP TABLE IF EXISTS nagiosxi;: No such file or directory
Restarting database servers...
Restoring logrotate config files...
Skipping Apache config files restoration

===============
RESTORE COMPLETE
===============



Re: Nagios Restoration to CentOS 7 from CentOS 5 backup

Posted: Thu Nov 09, 2017 12:07 pm
by npolovenko
Hello, @dbsaust. Have you attempted to repair the database with the script?

Code: Select all

cd /usr/local/nagiosxi/scripts/
./repair_databases.sh
I'd try that but if it doesn't work, the easiest solution would probably be to spin up a clean installation of XI and manually import the configuration files.

**This tutorial describes how to import configs from Core to XI, but it'll work for XI to XI as well:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
And you won't need to use a prep tool since you're migrating from the same version of XI.

Re: Nagios Restoration to CentOS 7 from CentOS 5 backup

Posted: Thu Nov 09, 2017 6:20 pm
by dbsaust
Hi @npolovenko ,
Yes, I did without any luck.
Regarding importing config files from Nagios core into Nagios XI, I will read your suggested document and will give it a go.

Update you here.

Thanks mate.

Re: Nagios Restoration to CentOS 7 from CentOS 5 backup

Posted: Fri Nov 10, 2017 11:07 am
by npolovenko
@dbsaust, Not a problem.