Host Group and Host Export to New Upgrade

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Sarg0n
Posts: 39
Joined: Mon Jun 12, 2017 9:58 am

Host Group and Host Export to New Upgrade

Post by Sarg0n »

I have been having issues with our Nagios XI instance as stated before in previous posts. I've come to believe that it's in the best interest if we build a new XI with more storage capacity and with a fresh install due to corruption issues. However, I want to have the same hosts as the current instance (we have close to 300 that we are monitoring) and I don't know if there is a way to export the hosts, groups, and services (configuration) without using the "Apply Configuration" button, which ISN'T WORKING. Is there perhaps a way to use the API urls which show the xml to move over the information to the new build? I have found several articles on exporting configurations, but they involve using the apply configuration method. Please assist.

Host info:
Nagios 5.4.4 is the corrupted host (where I want to move the host, services, alerts, and host group info from)
Nagios 5.4.13 is the new build (where I want to move it to)
CentOS 7.4.1708 OS
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: Host Group and Host Export to New Upgrade

Post by tacolover101 »

i *think* this should work for you - https://assets.nagios.com/downloads/nag ... ios-XI.pdf

if not, here's a few creative ways you could pull the info:
- /usr/local/nagios/var/status.dat - running config
- /usr/local/nagios/var/objects.cache - compiled config
- /usr/local/nagios/etc/* - folder should contain your raw config files, which you could get crafty with - https://assets.nagios.com/downloads/nag ... ios-XI.pdf
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Host Group and Host Export to New Upgrade

Post by npolovenko »

Thanks, @tacolover101.
@Sarg0n, As tacolover suggested you should be able to get the written config files from /usr/local/nagios/etc/ and import them into the new XI:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Sarg0n
Posts: 39
Joined: Mon Jun 12, 2017 9:58 am

Re: Host Group and Host Export to New Upgrade

Post by Sarg0n »

Thanks for all of your replies. So do I basically need to use the import tool on each .cfg file under /usr/local/nagios/etc/ , which sends them to my working directory? If so, do I transfer them over to my new Nagios XI build, and then import?
Sarg0n
Posts: 39
Joined: Mon Jun 12, 2017 9:58 am

Re: Host Group and Host Export to New Upgrade

Post by Sarg0n »

And in order to import all of the hosts, do I have to individually run the import tool on each .cfg file for each host? Which would take a long time...
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Host Group and Host Export to New Upgrade

Post by npolovenko »

@arg0n, You can use FileZilla or WinSCP to transfer all the host cfg files to /usr/local/nagios/etc/custom_directory/ on the new XI server.
And then use the Import Config tool to import all cfg files at once. When you select the cfg files hold down the shift key to select multiple items.
Hope this helps.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Sarg0n
Posts: 39
Joined: Mon Jun 12, 2017 9:58 am

Re: Host Group and Host Export to New Upgrade

Post by Sarg0n »

If that's true, can I just WinSCP all of the cfg files under etc and import them as you suggested? Or are you saying I can only do that with the host configurations?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Host Group and Host Export to New Upgrade

Post by npolovenko »

@Sarg0n, I wouldn't take all the files without knowing whats inside them. For example, you don't need nagios.cfg file, ncpa.cfg or cgi.cgf, etc because there are no definitions inside these files.

Here's the list of what you can transfer:

Commands Time Periods Contact Templates Contacts Contact Groups Host Templates Hosts Host Groups Service Templates Services Service Groups
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Host Group and Host Export to New Upgrade

Post by gormank »

I import using the following import order and do them individually. That is import hosts before hostgroups for example. I just copy a file or files into the import dir and run the reconfigure script, then repeat for other files.

commands
timeperiods
contacttemplates
contacts
contactgroups
hosttemplates
hosts
hostgroups
servicetemplates
services
servicegroups
Sarg0n
Posts: 39
Joined: Mon Jun 12, 2017 9:58 am

Re: Host Group and Host Export to New Upgrade

Post by Sarg0n »

So...I appear to be making some progress on this thanks to the last post. I copied Commands, Time Periods, Contact Templates, Contact, Contact Groups, Host Templates, Hosts, Host Groups, Service Templates, Services, and Service Groups over to the /usr/local/nagios/etc directory as instructed and it appears that it may have worked. CCM shows all the hosts and services. Everything on the XI System Component Status is showing green...except for ndo2db service. It is not running. 'Systemctl status ndo2db' shows a failed state and the failing warning says "Could not bind socket: Address already in use".

We are almost there...please help.

Thanks!
Locked