Page 1 of 3
Errors Restoring XI
Posted: Thu Oct 22, 2015 12:37 am
by Fred Kroeger
Just upgraded to NagiosXI 5 R2.0 and have been testing the Backup and most importantly the Restore!
It appears to be working correctly but throws up some errors which are wrong and states that it is exiting and it doesn't!
Code: Select all
# /usr/local/nagiosxi/scripts/restore_xi.sh /store/backups/nagiosxi/nagiosxi.1445428805.tar.gz
[b]tar: nagiosxi.1445428805/nagiosxi.tar.gz: Not found in archive[/b]
tar: Exiting with failure status due to previous errors
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
tar: nagiosxi.1445428805/nagiosxi.tar.gz: Not found in archive
tar: Exiting with failure status due to previous errors
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
TS=1445490501
Extracting backup to /store/backups/nagiosxi/1445490501-restore...
In /store/backups/nagiosxi/1445490501-restore/nagiosxi.1445481005...
Backup files look okay. Preparing to restore...
It then continues and & restores successfully.
Had a look at the nested tarball (via tar tzf ) and the file nagiosxi.1445428805/nagiosxi.tar.gz definitely exists so not sure why it's reporting that it can't find it?
The restore script is the latest
Code: Select all
# ls -la /usr/local/nagiosxi/scripts/restore_xi.sh
-rwxr-x--- 1 nagios nagios 8111 Oct 22 13:03 /usr/local/nagiosxi/scripts/restore_xi.sh
Any ideas ?
Regards.... Fred
Re: Errors Restoring XI
Posted: Thu Oct 22, 2015 9:43 am
by lmiltchev
Are you getting the same errors if you run the "restore_xi.sh" script from within the scripts directory?
Code: Select all
cd /usr/local/nagiosxi/scripts
./restore_xi.sh /store/backups/nagiosxi/nagiosxi.1445428805.tar.gz
Re: Errors Restoring XI
Posted: Thu Oct 22, 2015 10:49 pm
by Fred Kroeger
Yes - that worked without errors!
Is there something that needs to be changed in the script?
Here's another problem
I have a brand new XI5 R2.0 VM just downloaded and installed
I trying to import the Nagios data from an old Nagios Server that has been upgraded to XI5 R2.0 - so they both are running the same version.
It's failing because the new VM doesn't run Postgres.
Note this doesn't throw up errors because I'm not in the scripts directory!
Code: Select all
# cd /store/backups/nagiosxi
# /usr/local/nagiosxi/scripts/restore_xi.sh /store/backups/nagiosxi/bdcvngs037.tar.gz
TS=1445571243
Extracting backup to /store/backups/nagiosxi/1445571243-restore...
In /store/backups/nagiosxi/1445571243-restore/bdcvngs037...
Backup files look okay. Preparing to restore...
Shutting down services...
Stopping nagios:. done.
Stopping ndo2db: head: cannot open `/usr/local/nagios/var/ndo2db.lock' for reading: No such file or directory
done.
NPCD Stopped.
Restoring directories to /...
Restoring Nagios Core...
Restoring Nagios XI...
Restoring NagiosQL...
Restoring NagiosQL backups...
Restoring NRDP backups...
tar (child): /store/backups/nagiosxi/1445571243-restore/bdcvngs037/nrdp.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Restoring MRTG...
cp: cannot stat `/store/backups/nagiosxi/1445571243-restore/bdcvngs037/conf.d': No such file or directory
Restoring MySQL databases...
/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize the cluster first.
[FAILED]
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 "/tmp/.s.PGSQL.5432"?
Error restoring PostgresQL database 'nagiosxi' !
So How do I load all my configs from the old Nagios server to the brand new one.
Fred
Re: Errors Restoring XI
Posted: Fri Oct 23, 2015 9:20 am
by ssax
Interesting, looks like you've found a bug, I'll take a look at the code for this and see if I can provide you with a workaround.
Re: Errors Restoring XI
Posted: Fri Oct 23, 2015 9:23 am
by ssax
Update: The developers are aware of this and are working on a solution.
Re: Errors Restoring XI
Posted: Fri Oct 23, 2015 9:30 am
by lmiltchev
Our developers are working on a "postgres-to-mysql" conversion script. I don't have an ETA on that but expect it to be done soon. For the time being, the only way to restore an old XI instance (running postgres) on a new server, running XI 5 (no postgres) is to manually import the configs.
CCM->Import Config Files
You will need to import configs in the following order:
commands -> timeperiods -> contacttemplates -> contacts -> contactgroups -> hosttemplates -> hosts -> hostgroups -> servicetemplates -> services -> servicegroups
Re: Errors Restoring XI
Posted: Sun Oct 25, 2015 8:29 pm
by Fred Kroeger
Thanks Ludmil - I think I'll wait for the fix so that I can test it in our environment.
Can you let me know as soon as a solution is released?
regards ... Fred
Re: Errors Restoring XI
Posted: Mon Oct 26, 2015 1:01 pm
by lmiltchev
Can you let me know as soon as a solution is released?
Sure. I can do that.
Re: Errors Restoring XI
Posted: Mon Nov 16, 2015 8:23 pm
by Fred Kroeger
Just picked up more problems with the XI Restore script - I am running this via Cron daily
All appears to work well except for the NRDP extract and a couple of other commands.
Unfortunately the NRDP folder gets deleted at the start of the restore process, so my target system stops receiving NRDP messages.
Code: Select all
TS=1447721261
Extracting backup to /store/backups/nagiosxi/1447721261-restore...
In /store/backups/nagiosxi/1447721261-restore/Host037...
Backup files look okay. Preparing to restore...
Shutting down services...
Stopping nagios:.. done.
Stopping ndo2db: done.
NPCD Stopped.
Restoring directories to /...
Restoring Nagios Core...
Restoring Nagios XI...
Restoring NagiosQL...
Restoring NagiosQL backups...
[b]Restoring NRDP backups...
tar (child): /store/backups/nagiosxi/1447721261-restore/Host037/nrdp.tar.gz: Cannot open: No such file or directo
ry
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now[/b]
Restoring MRTG...
[b]cp: cannot stat `/store/backups/nagiosxi/1447721261-restore/Host037/conf.d': No such file or directory[/b]
[b]Restoring MySQL databases...
./restore_xi.sh: line 217: service: command not found[/b]
Restoring Nagios XI PostgresQL database...
Note: I have run the same command from the command line and the same errors are displayed.
BTW - Any Update on the fix to the Restore problem to a new NagiosXI 5 system caused by the removal of the postgresql d/bases?
regards... Fred
Re: Errors Restoring XI
Posted: Tue Nov 17, 2015 2:40 pm
by tgriep
On the system that you create the backups, does it have enough space to create the backups?
Can you run the backup script on that system to see if thee any errors generated?
Thanks.