Restore of database - Database error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Restore of database - Database error

Post by mccrakem »

Hi
I'm moving Nagiosxi to a new CentOS7 Server
I have migrated 6 systems so far and all have went well apart from this last one

I install Nagiosxi 5.6.14
I access the URL and all looks fine I can login with the nagiosadmin user as its the default database there is no hosts
I restore from a backup I took this morning backup is approx 5.7GB

I run the tarball as we are moving from RHEL6 to CentOS7

when the tarball is complete I just get the error

Database Error

Screen shot attached

I run the command
/usr/local/nagiosxi/scripts/repair_database.sh

seems to complete without issues
only this is when its complete it only lists 2 database does not mention the nagiosxi database

Screenshot attached

So I tried to run the repairmysql.sh nagiosxi but nothing happens

Screenshot attached
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: Restore of database - Database error

Post by lmiltchev »

Was your "old" system using postgres? Maybe nagiosxi db is there. What is the output of the command below?

Code: Select all

echo '\d' | psql nagiosxi nagiosxi
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: Restore of database - Database error

Post by mccrakem »

Hi Here are the screenshots from the provided command on both Nagios system
Current and New
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: Restore of database - Database error

Post by lmiltchev »

OK, so I was correct about postgres being used on your old system. This shouldn't be a problem though. Are you still seeing db errors? What is the actual issue that you are currently having?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: Restore of database - Database error

Post by mccrakem »

Hi

When I start the server (it is currently off at the moment and the original server is still running RHEL6)
All I get is the Database Error shown in the screenshot
and when I try and repair the database nothing happens it says Repair Complete but all I see if that message no login screen nothing just that message

Thanks
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Restore of database - Database error

Post by lmiltchev »

Is postgreql running on the new server? Run the following commands, and show the output:

Code: Select all

service postgresql restart
service postgresql status
Also, you are changing the OS version, so I wonder - have you tried running the "restore_repair.sh" script as described on page 13 in the document below?

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

If you haven't, try running it to see if this is going to fix your issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: Restore of database - Database error

Post by mccrakem »

Hi

I had run the restore_repair.sh script
But this morning what I did was removed Nagiosxi and did a complete new install and then tested another Database restore

I got the same issue, so I am working if this is a corrupted backup
I will see if i can run another backup and run the restore with the new backup

I have attached a screenshot of the postgresql status
I have attached a copy of the restore text

I found the following which is very similar to the issue I am seeing
https://support.nagios.com/forum/viewto ... 6&start=10


Commands
echo "vacuum;vacuum analyse;vacuum full;"|psql nagiosxi postgres
echo "vacuum;vacuum analyse;vacuum full;"|psql postgres postgres
echo "vacuum;vacuum analyse;vacuum full;"|psql template1 postgres

Output
echo "vacuum;vacuum analyse;vacuum full;"|psql nagiosxi postgres
VACUUM
VACUUM
VACUUM

echo "vacuum;vacuum analyse;vacuum full;"|psql postgres postgres
VACUUM
VACUUM
VACUUM

echo "vacuum;vacuum analyse;vacuum full;"|psql template1 postgres
VACUUM
VACUUM
VACUUM
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: Restore of database - Database error

Post by lmiltchev »

How much space do you have on the new server?

Code: Select all

df -h
Have you checked both logs (postgres and mysql) for errors?

The postgres logs should be located in the "/var/lib/pgsql/data/pg_log" directory. You can use tail to view the most recent log, e.g.:

Code: Select all

tail -100 /var/lib/pgsql/data/pg_log/postgresql-Wed.log
For mysql logs, you could run this:

Code: Select all

tail -100 /var/log/mysqld.log
or this:

Code: Select all

tail -100 /var/log/mariadb/mariadb.log
depending on whether you are using mysql or mariadb.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: Restore of database - Database error

Post by mccrakem »

Hi

Find attached the output from the above commands

Can you take a look and see if anything stands out to you

Thanks
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: Restore of database - Database error

Post by lmiltchev »

When you run the repair on the db (mysql), according to your screenshot:
example-01.jpg
nagiosxi db is not present in mysql. Only nagios and nagiosql databases are repaired. Since you are restoring from an old system, nagiosxi db must be in postgres. But looking at your postgres log, I see this:
FATAL: database "nagiosxi" does not exist
Are you sure your backup is not corrupted? Can you find the nagiosxi db in the backup tarball? Is it in postgres or mysql?
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked