Hello,
Apologies if my question is too detailed to ask. But I was wondering if there is some kind of script or fast way for post-transfer bulk renames?
For example : build a delimited file that has hostnameX that should be renamed to hostnameY, along with IPaddressX replaced with IPaddressY in the config files.
Best Regards,
Peter
Script
Re: Script
I don't believe so. You could probably script something out accordingly, and use it to replace strings before importing them into XI.
What exactly are you looking to accomplish?
What exactly are you looking to accomplish?
Former Nagios Employee
Re: Script
Hello,
What I am trying to do is , I want to mirror all my config(Hosts/Services/IPs) from my Nagios XI Server on to my Lab Nagios XI Server so I can replicate what I have in live.
Once that is done, obviously the IP addresses of the devices Nagios is monitoring in live are different from the ones Nagios is monitoring In lab (we have a replication of all our live nodes in lab too).
So once I have imported all live config in the lab , I will have to change the IP addresses to the lab nodes and instead of entering them manually(200+IP) I was looking for a script where I could enter all live IP 'X' and all lab IP 'Y' and the script will replace them.
I know this is a bit specific but I wanted to check if someone had that issue and have a solution before I create my own script.
If not, I will share what I come up with.
Thanks,
Peter
What I am trying to do is , I want to mirror all my config(Hosts/Services/IPs) from my Nagios XI Server on to my Lab Nagios XI Server so I can replicate what I have in live.
Once that is done, obviously the IP addresses of the devices Nagios is monitoring in live are different from the ones Nagios is monitoring In lab (we have a replication of all our live nodes in lab too).
So once I have imported all live config in the lab , I will have to change the IP addresses to the lab nodes and instead of entering them manually(200+IP) I was looking for a script where I could enter all live IP 'X' and all lab IP 'Y' and the script will replace them.
I know this is a bit specific but I wanted to check if someone had that issue and have a solution before I create my own script.
If not, I will share what I come up with.
Thanks,
Peter
Re: Script
I've done this between sites by copying config files from for example the hosts dir to the import dir on another Nagios installation, then searching and replacing hostname/IP in the config files and then running reconfig to import.
I've read that the recommended import order is:
commands
timeperiods
contacttemplates
contacts
contactgroups ->hosttemplates
hosts
hostgroups
servicetemplates
services
servicegroups
Have a look under /usr/local/nagios/etc/ at the various .cfg files.
Another idea is to generate hosts from a list of host,IP,etc. values in a .csv file. Then a reconfig would import them.
I've read that the recommended import order is:
commands
timeperiods
contacttemplates
contacts
contactgroups ->hosttemplates
hosts
hostgroups
servicetemplates
services
servicegroups
Have a look under /usr/local/nagios/etc/ at the various .cfg files.
Another idea is to generate hosts from a list of host,IP,etc. values in a .csv file. Then a reconfig would import them.
Re: Script
Apologies for the late reply. I have forgotten this post.
I successfully imported my config following the guides and as advised.
I am fine with closing this post.
Best Regards,
Peter
I successfully imported my config following the guides and as advised.
I am fine with closing this post.
Best Regards,
Peter