Backup of the Nagios Core

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Backup of the Nagios Core

Post by amitgupta19 »

How to take the backup of the Nagios Core?

Is there any script with which i can take the backup of the Nagios?

Please suggest.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Backup of the Nagios Core

Post by npolovenko »

Hello, @amitgupta19. I believe Nagios Core does not have a sophisticated backup solution like Nagios XI. You may find a custom script on the internet that does it. However, usually it all comes down to backing up the/usr/local/nagios/etc folder. That's where all the main configs are stored. You may use FileZilla or WinSCP to download the whole folder. If you're running nagios Core on a Virtual machine, then making a snapshot would be an ideal solution.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Backup of the Nagios Core

Post by t3dus »

What I do is I mount an external drive using 7zip. normal zip doesn't do a super great job of getting all the files.

My nagios is on Ubuntu not CentOS so ur commands might vary slightly.

If u don't have 7zip install then install it

Code: Select all

sudo apt-get install p7zip-full
then plugin in your ext drive and find the ext drive once u plugged in it by typing:

Code: Select all

fdisk -l
Returns something like this

Code: Select all

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdb1          63 1465144064 1465144002 698.7G  7 HPFS/NTFS/exFAT
Mount the drive

Code: Select all

mount /dev/sdb1 /media/bkup
then I run this command to back it up using 7zip

Code: Select all

7z a -t7z "/media/bkup/nagios.$(date +"%F").7z" /usr/local/nagios
The code above assumes you have mounted a ext drive to /media/bkup/ and will backup /usr/local/nagios folder to it.

The finished files look something like this.. "nagios.2017-12-06.7z"

I used to use a normal zip command but it had a problem where it couldn't always backup all the config files.
Last edited by t3dus on Sat Dec 09, 2017 6:48 pm, edited 1 time in total.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Backup of the Nagios Core

Post by npolovenko »

@t3dus, Thanks for sharing your recommendation!
@amitgupta19, Please let us know if you have any other questions related to this topic.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: Backup of the Nagios Core

Post by amitgupta19 »

I am just copying the files from the folder where all the configuration files are located.

I hope that it is ok, at the time of restoring this should work?
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Backup of the Nagios Core

Post by t3dus »

As long as you backup "/usr/local/nagios" and all the directories after that that then that will contain all the Nagios config files needed for restore provided that you did the default install and didn't install to a separate location.
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: Backup of the Nagios Core

Post by amitgupta19 »

In the /usr/local/nagios i can see the following 2 Folders: Refer to the screenshot(Backup)

and i am taking the backup of the folder: Refer to the screenshot attached(Backup-1)

How to ensure that installation has been done without changing the default location? Because i didn't installed the Nagios and i am also new to Nagios.
Attachments
/etc/nagios
/etc/nagios
/usr/local/nagios
/usr/local/nagios
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Backup of the Nagios Core

Post by t3dus »

What Nagios Version are you running? My guess is version 3?

Looks like yours may be installed a bit differently than the version I run which is 4.3.4.

Your config files are under /etc/nagios while mine are under /usr/local/nagios

This is what I see under my folder /usr/local/nagios

Code: Select all

# /usr/local/nagios# ls -1
bin
etc
include
libexec
sbin
share
var
My main config files exist under the folder called "etc" and my host objects are in a folder under that called "objects"

Code: Select all

/usr/local/nagios# :/usr/local/nagios# ls -1 etc
cgi.cfg
htpasswd.users
nagios.cfg
objects
resource.cfg
Last edited by t3dus on Tue Mar 06, 2018 4:28 pm, edited 1 time in total.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Backup of the Nagios Core

Post by npolovenko »

@amitgupta19, Looks like the main folder with all the configs on your system is /etc/nagios/. Have you considered spinning up Nagios Core on a Virtual machine? That way you could make system snapshots and revert any time.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: Backup of the Nagios Core

Post by amitgupta19 »

@t3dus: Version of the Nagios Core that i am using is 3.3.1

Does it makes sense to keep a copy of the configuration files , in my case. So that i can restore the backup at any point of time.


@npolovenko: Currently nagios Core is running on the Physical machine.
Locked