Page 1 of 1

transfer all host in a specific group to another xi server

Posted: Mon Jul 01, 2019 2:26 pm
by rnjie
i have 2 nagios xi servers and i am currently monitoring 300hosts on each server, i have decided to move all hosts from one server belonging to a specific group called "network" over to the other server, what will be the best way to do this?

Re: transfer all host in a specific group to another xi serv

Posted: Mon Jul 01, 2019 4:23 pm
by scottwilkerson
Unfortunately there isn't an easy way to select config files for specific groups of hosts as they are not organized that way in XI, you would need to grab the configurations for each of these hosts and services individually and import them.

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: transfer all host in a specific group to another xi serv

Posted: Tue Jul 02, 2019 10:33 am
by rnjie
thanks, you said it is not setup in nagios xi that way for groups? just be clear, i am moving this hosts from one nagios xi server to another nagios xi server and not from nagios core to nagios xi.

Re: transfer all host in a specific group to another xi serv

Posted: Tue Jul 02, 2019 12:15 pm
by scottwilkerson
rnjie wrote:thanks, you said it is not setup in nagios xi that way for groups? just be clear, i am moving this hosts from one nagios xi server to another nagios xi server and not from nagios core to nagios xi.
I understood that, I was saying that the config files aren't organized by groups, so there isn't a way to specify a group and get all the configs for that group to import in the other server.

Re: transfer all host in a specific group to another xi serv

Posted: Tue Jul 02, 2019 12:36 pm
by rnjie
thank you, i was thinking of another approach, so is there a way to "move" instead of "import " these servers to another server, take for example i wanto move9migrate) a 100 servers from my current nagios xi server to another nagios xi server, what will be the files i would copy over can i just copy the cfg files of each server to the other one and restart nagios and i see it monitoring?

Re: transfer all host in a specific group to another xi serv

Posted: Tue Jul 02, 2019 12:47 pm
by scottwilkerson
rnjie wrote:thank you, i was thinking of another approach, so is there a way to "move" instead of "import " these servers to another server, take for example i wanto move9migrate) a 100 servers from my current nagios xi server to another nagios xi server, what will be the files i would copy over can i just copy the cfg files of each server to the other one and restart nagios and i see it monitoring?
You would need to follow this doc to import the configs
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Even though the doc is for a Core to XI migration, the process is the same.

And because you likely have hostgroups, servicegroups, contactgroups, contacts, commands, etc. on the server you are moving from you would need to make sure you import them as well, for the contacts you would also want to make sure you have XI users created for each.

The order you import in is outlined in the doc and the GUI and is very important.

Re: transfer all host in a specific group to another xi serv

Posted: Tue Jul 02, 2019 3:06 pm
by rnjie
thank you for your response, i decided to follow the link you provided but i am kind of confused at the steps under "using the config import prep too"
i am confused which server to run each command on
so i want to move servers from nagiosxi-serverA to nagiosxi-serverB, so which server do i run the php script on in the doc, nagios core server was mentioned only once and that was to copy the config files over ssh . see the steps outlined below


Tool Location And Command Line Syntax
The import prep tool script is located in the following directory of the XI monitoring server:
/usr/local/nagiosxi/tools
The script can be run from a shell prompt using the following syntax:
php /usr/local/nagiosxi/tools/xiprepimport.php sourceconfigfile
where sourceconfigfile is the path to the source configuration file. Note: the source config file cannot
reside in the current working directory.
Using The Config Import Prep Tool
To use the config import prep tool, follow the steps below.
Establish a terminal session to your Nagios XI server as the root user.
Create a temporary directory for holding the converted configuration files. This directory must be located
beneath the /usr/local/nagios/etc directory structure. Example:
mkdir /usr/local/nagios/etc/cfgprep
Create a subdirectory for holding the original source configuration files you wish to prep for import:
mkdir /usr/local/nagios/etc/cfgprep/orig
Upload (via SSH, etc.) your original source configuration files from your Nagios Core instance to this directory
(/usr/local/nagios/etc/cfgprep/orig)

Re: transfer all host in a specific group to another xi serv

Posted: Tue Jul 02, 2019 3:12 pm
by scottwilkerson
You would run all these commands on the machine you are moving to

Re: transfer all host in a specific group to another xi serv

Posted: Tue Jul 02, 2019 3:33 pm
by rnjie
what about the last step of Upload (via SSH, etc.) your original source configuration files from your Nagios Core instance to this directory
(/usr/local/nagios/etc/cfgprep/orig),

which file is (the original source) from the other server if i have to run all these commans on one server.

Re: transfer all host in a specific group to another xi serv

Posted: Tue Jul 02, 2019 3:41 pm
by scottwilkerson
This is where is is going to get tricky, these files you would get from the origin server, they are all located under /usr/local/nagios/etc

you will need
timeperiods.cfg
commands.cfg
contacts.cfg
contactgroups.cfg
hosttemplates.cfg
servicetemplates.cfg

then possibly portions of:
servicegroups.cfg
hostgroups.cfg

Finally you will need the files from inside the hosts and services sub directories that correspond to what you want to move.

As I mentioned before there isn't an easy method to do this as there is not a mechanism to grab just a portion of the configs.