nagiosxi database restore failing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rc00512011
Posts: 10
Joined: Tue May 23, 2017 2:06 am

nagiosxi database restore failing

Post by rc00512011 »

Hi Team,
we have nagiosxi application backup and i have deleted /var/lib/mysql/mysql/nagiosxi .MYI, .frm & MYD files.
My restore is failling due to nagiosxi is not getting restored due to above missing files. how can i restore the nagiosxi if any of DB files missing or dont have enough db files to load.

regards,
Ranjit Chavan
dwasswa

Re: nagiosxi database restore failing

Post by dwasswa »

Hi @rc00512011,

Did you delete those files yourself or XI did?

Were the files deleted from the backup or before the backup?

Can you please post the error.
rc00512011
Posts: 10
Joined: Tue May 23, 2017 2:06 am

Re: nagiosxi database restore failing

Post by rc00512011 »

tar: usr/local/nagiosxi/var/xi-sys.cfg: Not found in archive
tar: Exiting with failure status due to previous errors
WARNING: you are trying to restore a 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
tar: usr/local/nagiosxi/var/xi-sys.cfg: Not found in archive
tar: Exiting with failure status due to previous errors
TS=1506670093
Extracting backup to /store/backups/nagiosxi/1506670093-restore...
In /store/backups/nagiosxi/1506670093-restore/nagiosxi.1504025281...
Backup files look okay. Preparing to restore...
Shutting down services...
Restoring directories to /...
Restoring Nagios Core...
tar: usr/local/nagios: Cannot open: File exists
tar: Exiting with failure status due to previous errors
tar: usr/local/nagios/libexec/*.*: Not found in archive
tar: Exiting with failure status due to previous errors
Restoring Nagios XI...
cp: cannot create regular file â/usr/local/nagiosxi/scripts/../var/xi-sys.cfgâ: No such file or directory
Restoring NagiosQL...
Restoring NagiosQL backups...
Restoring NRDP backups...
Restoring MRTG...
Restoring Nagvis backups...
./restore_xi.sh: line 190: /usr/local/nagiosxi/scripts/../var/xi-sys.cfg: No such file or directory
./restore_xi.sh: line 191: /usr/local/nagiosxi/scripts/config.dat: No such file or directory
./restore_xi.sh: line 192: /usr/local/nagiosxi/scripts/config.dat: No such file or directory
Restoring MySQL databases...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")
Error restoring MySQL database 'nagios' - check the password in this script!
rc00512011
Posts: 10
Joined: Tue May 23, 2017 2:06 am

Re: nagiosxi database restore failing

Post by rc00512011 »

i'm not ble to drop, nagios or nagiosxi db, i could blank it first then will try to restore... i dont have original error as i messed up with db it seems.
How i can restore my mysql? is there any way i can re-install mysql? or any suggestions to restore it back to normal?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: nagiosxi database restore failing

Post by scottwilkerson »

You should not delete any files.

When restoring you want to run the restore script on a system that has the installation performed and not modified.

Here is a document outlining the procedure
https://support.nagios.com/kb/article.php?id=180
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
rc00512011
Posts: 10
Joined: Tue May 23, 2017 2:06 am

Re: nagiosxi database restore failing

Post by rc00512011 »

This is the error i'm getting when i try dropping the table:
[root@nodea bin]# mysqladmin -u root -p drop nagiosxi
Enter password:
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.

Do you really want to drop the 'nagiosxi' database [y/N] y
mysqladmin: DROP DATABASE nagiosxi failed;
error: 'Error dropping database (can't rmdir './nagiosxi', errno: 39 "Directory not empty")'


##################################

How can i build nagiosxi db in order to behave nagiosxi normally?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: nagiosxi database restore failing

Post by dwhitfield »

Do you have backups from before you deleted those files?

It looks like you have more than just mysql not in your backup. For example tar: usr/local/nagiosxi/var/xi-sys.cfg: Not found in archive. It seems this particular backup is pretty broken.

I also note this in the output:
WARNING: you are trying to restore a backup on a x86_64 system
You really need to read through the backup and restore procedure: https://assets.nagios.com/downloads/nag ... ios-XI.pdf
rc00512011
Posts: 10
Joined: Tue May 23, 2017 2:06 am

Re: nagiosxi database restore failing

Post by rc00512011 »

I was able to resolve the issue, i removed nagiosxi dir from /var/lib/mysql/ ,,, in order to remove the nagiosxi database.
Restore worked after removing the nagiosxi db as it was currupted.

regards,
Ranjit Chavan
kyang

Re: nagiosxi database restore failing

Post by kyang »

Sounds great! I'll be closing this topic as resolved!

If you have any more questions, feel free to create another thread!

Thank you for using the Nagios Support Forum!
Locked