Manual / Cron'd backup

21 views
Skip to first unread message

William Pool

unread,
Oct 21, 2016, 12:38:51 PM10/21/16
to nagrestconf-users
I was curious, what's the procedure if I wanted to automate backup's of NagRestConfAPI via cron?

Also, since my company has taken full-force "Infrastructure as Code" what files/parts can be placed into Ansible on a restore of the server?

I see the /etc/nagios/objects/local has the config files, but will modifying/restoring from there break the SVN aspect in /etc/nagios/repos/local? 

If so, is there a way around this?

Mark Clarkson

unread,
Oct 24, 2016, 7:01:45 AM10/24/16
to nagrestconf-users

I previously had the idea to build backup and restore into nrcq so it could read and write the same backup files made by the UI, but I haven't needed the feature yet so didn't code it in.

I think the /etc/nagios/objects/<FOLDER>/setup.known_good could be saved. If that folder is written to a fully configured server, then 'nrcq .. apply/nagioslastgoodconfig' issued, then it should work and not mess up any subversion repo. I just tried with:

# cd
# tar -C /etc/nagios/objects/local -cvzf backup.tgz setup.known_good
# scp backup.tgz ro...@somewhere.else:
.. on the other server ..
# cd
# BASE=/etc/nagios3/objects/local
.. view the owners and perms ..
# ls -lhd $BASE/setup.known_good
drwxr-xr-x 2 www-data www-data 4....
# mv $BASE/setup.known_good $BASE/setup.known_good.old
# tar -C $BASE -xvzf backup.tgz
.. then chown with whatever user was as shown above with 'ls -lhd ...' ..
# chown -R www-data: $BASE/setup.known_good

Then I tried the 'Revert Changes' button in the nagrestconf GUI on the other server. That worked.

The backup that the UI does is only through REST, and that method would be nice in nrcq to do a remote backup. The 'nagioslastgoodconfig' method shown above has to be done locally on the nagios server for obvious reasons.


William Pool

unread,
Oct 24, 2016, 11:45:06 AM10/24/16
to nagrestconf-users
Excellent! I'll give that a shot this week.
Reply all
Reply to author
Forward
0 new messages