Page 1 of 2

Backup of the Nagios Core

Posted: Mon Dec 04, 2017 12:32 pm
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.

Re: Backup of the Nagios Core

Posted: Mon Dec 04, 2017 2:10 pm
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.

Re: Backup of the Nagios Core

Posted: Thu Dec 07, 2017 7:06 pm
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.

Re: Backup of the Nagios Core

Posted: Fri Dec 08, 2017 12:14 pm
by npolovenko
@t3dus, Thanks for sharing your recommendation!
@amitgupta19, Please let us know if you have any other questions related to this topic.

Re: Backup of the Nagios Core

Posted: Tue Mar 06, 2018 7:01 am
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?

Re: Backup of the Nagios Core

Posted: Tue Mar 06, 2018 7:10 am
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.

Re: Backup of the Nagios Core

Posted: Tue Mar 06, 2018 12:10 pm
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.

Re: Backup of the Nagios Core

Posted: Tue Mar 06, 2018 1:16 pm
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

Re: Backup of the Nagios Core

Posted: Tue Mar 06, 2018 4:15 pm
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.

Re: Backup of the Nagios Core

Posted: Wed Mar 07, 2018 5:31 am
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.