transfer all host in a specific group to another xi server

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

transfer all host in a specific group to another xi server

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

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

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

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

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

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

Post 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)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post by scottwilkerson »

You would run all these commands on the machine you are moving to
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

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

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked