NEMS Migrator: Restore

The NEMS Migrator tool allows you to export/backup your NEMS configuration (backup.nems) as well as import a previous backup (through the Restore option).

The NEMS Migrator’s backup and restore options are great for keeping a safe backup without having to shutdown your NEMS server. Just download the file once in a while, or back it up automatically with your daily backup script.

NEMS Migrator is also helpful when upgrading from previous versions of NEMS, saving you having to reconfigure your NEMS deployment just to get the latest features.

Important Note
I am a firm believer in redundancy, and protecting your data. What I’d like you to do is, export your migration file, then install NEMS on a new MicroSD card. Then boot from that and restore your NEMS Migrator backup. Once you’ve confirmed everything worked well, you can deprecate the old one safely. However, if something went wrong, you can contact me to fix it for you, and continue running from the old SD card in the interim.

How to Restore a NEMS Migrator Backup
Requires NEMS 1.2+

  1. Place your backup.nems file on a USB flash drive. You can access this directly from your web browser at http://NEMSIP/backup/ where NEMSIP is the IP address of the NEMS server you wish to backup.
  2. Deploy the version of NEMS you wish to restore the backup to. Please heed my Important Note above.
  3. Boot the new NEMS deployment and mount the USB flash drive.
  4. Determine the location of backup.nems in relationship to your mountpoint. For example, if you mounted the USB flash drive on /mnt/flash you may determine the location to be /mnt/flash/backup.nems
  5. Armed with that information, run the following command (use the full path to your backup.nems file):
  6. Follow the prompts on screen to restore your configuration to the new NEMS deployment. If it fails for any reason, you can safely shut down and replace the SD card with your original deployment.

If you have any problems (or praise) please comment below.

Leave a Reply

20 Comments on "NEMS Migrator: Restore"

Notify of
avatar
Sort by:   newest | oldest | most voted
Mycroft
Guest

 

Well,

Today i tried to restore my NagiosPi-Config on an Freshly installed Nems 1.2, but on the Action, something went terribly wrong.

Here https://pastebin.com/fsKfrQAN i’ve got the Output while restoring.

Well the Backup went through, except the already mentrioned Nagvis. But that’s nothing i worry about, i don’t use it at all.

Backup-Process:

sudo ./nagiospi2nems.sh
sudo: unable to resolve host <HOST>
Preparing nagiospi for NEMS-Migrator Backup…
Running NEMS-Migrator backup…
Created backup folder at /var/www/html/backup
[….] Stopping nagios3 monitoring daemon: nagios3Waiting for nagios3 daemon to die…..
. ok
tar: Entferne führende „/“ von Elementnamen
tar: /etc/nagvis/maps: Kann stat nicht ausführen: Datei oder Verzeichnis nicht gefunden
tar: Datei /var/log/dpkg.log.1 ist um 27478 Bytes geschrumpft, fülle mit Nullen auf.
tar: Beende mit Fehlerstatus aufgrund vorheriger Fehler
[ ok ] Starting nagios3 monitoring daemon: nagios3.
Done. You’ll find the backup at /var/www/html/backup/backup.nems

You can access the file from your computer by navigating to http://NEMSIP/backup/

Download the file from another computer: http://*NAGIOSPI-IP*/backup/backup.nems

 

Did something change on the NEMS part, due to the Upgrade from 1.1 to 1.2?

Maybe a Hint on what i should put an Eye on?

 

Thanks in Advance

Kasper Biel
Guest

Hi

I have the same issue as Mycroft

I get:
[ Initializing NConf perl-API (library version 0.3, written by A. Gargiulo) ]
[ Copyright (c) 2006 – 2013 Sunrise Communications AG, Zurich, Switzerland ]

[INFO] Started executing /var/www/nconf/bin/add_items_from_nagios.pl
DBI connect(‘database=nconf;host=localhost’,’nconf’,…) failed: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”) at /var/www/nconf/bin/lib/NConf/DB.pm line 81.

If i type systemctl status mysql.service i get:

● mysql.service – MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-05-09 12:38:55 CEST; 1min 51s ago
Process: 7536 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Main PID: 561 (code=exited, status=0/SUCCESS)

May 09 12:38:55 NEMS systemd[1]: mysql.service: Unit entered failed state.
May 09 12:38:55 NEMS systemd[1]: mysql.service: Failed with result ‘exit-code’.
May 09 12:38:55 NEMS systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
May 09 12:38:55 NEMS systemd[1]: Stopped MySQL Community Server.
May 09 12:38:55 NEMS systemd[1]: mysql.service: Start request repeated too quickly.
May 09 12:38:55 NEMS systemd[1]: Failed to start MySQL Community Server.
May 09 12:38:55 NEMS systemd[1]: mysql.service: Unit entered failed state.
May 09 12:38:55 NEMS systemd[1]: mysql.service: Failed with result ‘exit-code’.

I hope you have a fix

Hesh
Guest

Rob… excellent job.

The restore command worked like a charm

Many thanks…

Rick
Guest

No worries.  I am looking forward to implementing the email component.  I have 23 hosts monitoring 61 services, so I will wait for the restore to be ready.  I do appreciate all of your work on this.

Rick
Guest

Thanks for the upgrade on NEMS.  Another fine job. But I seem to be missing something on the Restore.

I backed up my 1.0 version using the instructions and now have a nice backup file. But when I click on the Restore link on the 1.1 version home screen, it links to your blog page.

I can not seem to figure out how to invoked the Restore. At this point I fell back to 1.0 (since I listened to your warning and installed 1.1 on a new SD card, good tip. Fallback was easy).

Thanks again,

Rick

wpDiscuz