Page 1 of 1

nagiosxi database restore failing

Posted: Thu Sep 28, 2017 11:26 am
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

Re: nagiosxi database restore failing

Posted: Thu Sep 28, 2017 11:51 am
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.

Re: nagiosxi database restore failing

Posted: Fri Sep 29, 2017 2:33 am
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!

Re: nagiosxi database restore failing

Posted: Fri Sep 29, 2017 2:37 am
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?

Re: nagiosxi database restore failing

Posted: Fri Sep 29, 2017 9:19 am
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

Re: nagiosxi database restore failing

Posted: Wed Oct 04, 2017 8:25 am
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?

Re: nagiosxi database restore failing

Posted: Wed Oct 04, 2017 2:27 pm
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

Re: nagiosxi database restore failing

Posted: Fri Oct 13, 2017 7:48 am
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

Re: nagiosxi database restore failing

Posted: Fri Oct 13, 2017 8:58 am
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!