Category5.TV Community Forum

Full Version: Issue with restoring backup.nems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been messing around with NEMS the past few days and I ran into an issue with restoring a backup.nems file.

I have an SD card that I am using that is questionable. I decided that I would back everything up and then restore it to a fresh card.

I've done the back up twice and ran into an issue that seems strange to me. 

I get the following messages when I try to restore;

Backup file is from NEMS 1.4.1. Proceeding.
Source: /tmp/nems_migrator_restore/etc/nems/conf
PHP Parse error:  syntax error, unexpected end of file in /root/nems/nems-migrator/data/ on line 142
Creating a clean NEMS NConf configuration... Using v1.4 defaults... Done.
Importing Nagios Configs to NEMS NConf...
Importing: timeperiod
Importing: misccommand
Importing: checkcommand
Importing: contact
Importing: contactgroup
Importing: host-template
Importing: host
Importing: hostgroup
Importing: host-dependency
Importing: service-template
Importing: service
Importing: advanced-service
[ERROR] Could not read from /tmp/reconcile-advanced-services.cfg. Aborting.
rm: cannot remove '/tmp/reconcile-advanced-services.cfg': No such file or directory
Importing: servicegroup
Importing: service-dependency
Connecting default monitor to NEMS... Done.
Activating default host presets...  Done.
 Importing: $USER1$=/usr/local/nagios/libexec
 Importing: $USER2$=/usr/share/nagios3/plugins/eventhandlers
 Importing: $USER3$=SECRET
 Importing: $USER4$=SECRET
 Importing: $USER5$=nems@SECRET
 Importing: $USER6$=NULL
 Importing: $USER7$
 Importing: $USER8$=NULL
 Importing: $USER9$=nems@SECRET
 Importing: $USER10$=SECRET
 Importing: $USER11$=NULL
 Importing: $USER12$=NULL
 Importing: $USER13$=NULL
 Importing: $USER14$=NULL
 Importing: $USER15$=1
Consolidation complete.

I hope everything worked okay for you.
Please let me know if you had any trouble.

PS - I saved a backup for you of the old config. /root/backup.nems
... just in case

I've changed $USER3$,4$,8$,9$, and 10$ because it has some privileged info there.

The things that popped out at me was the PHP parse error at the beginning and could not read from /tmp/reconcile-advanced-services.cfg.

When I do open up NConf, all of the hosts and advanced services are gone. It's like it really cleaned everything out when it ran the restore.

I didn't know if I was doing something wrong when I backued up the config or if there is truly a bug here.
Hmm, it looks like the reconciler crapped out on you. I'm investigating this for you now. Hang tight.
The issue should be fixed now.
1) Run as root: nems-update
2) Run your nems-restore command as before

If any new error messages appear, please let me know and I will tackle them as well.

This bug came about as I migrated NEMS Migrator over to the new NEMS 1.5 (coming soon) and accidentally broke compatibility in 1.4.1. Sorry for the error! :)

Your backup will be fine; this bug only affected the ability to restore the reconciled data.


I did come back into work this evening and test this on my bad SD card. I burned it from scratch, and then did the nems-init.

Once I did that, I pulled the backup.nems from a flash drive and it did restore it seemed with no issues.

Thanks for your help on this! Hopefully this will work for our school district here in Ohio for our district network.

Thanks for the update Matt. If there is anything I can do to help, just let me know. I would truly be honored to have NEMS in use in your school district. If it goes well, let's chat about a case study.

Email me when you have time?

Side note: NEMS 1.5 is introducing NEMS Cloud, which allows you to monitor several sites from a single dashboard (like NEMS TV Dashboard; a single screen to see an overview). NEMS 1.5 also tells you in its notifications which site is reporting. So these features could really help with multi-school deployments. I'd be pleased to have a real-world use case to refer to.


For sure we can talk more. I get a better chance this week, I'll send you more info about what we do and were we see us using NEMS in our environment. 

Right now, I'm using my own personal Raspberry Pi's to do this, but the hope is to ramp this up in the next few weeks with a permanent device.

Very nice, Matt.
Keep in mind, NEMS 1.5 is right around the corner (looking like a December release).

Looking forward to learning more, and having NEMS be a part of your IT infrastructure! It's an honor!