Changing from IP Addresses to Hostnames in Services cfg file

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Changing from IP Addresses to Hostnames in Services cfg file

Post by mccrakem »

Hi

we are doing a move of our environment to a new site and the IP Address ranges are changing
but in the past some people created the Monitored Hosts and Servers and configured them with IP Addresses

I can successfully use the Import Config Files Tool to change the Hosts from IP Addresses to Hostnames, but the Import Config File Tool does not seem to work for the services config files

Is there a different method or am i just not doing it correctly
The config file in the hosts directory and the config file in the services directory both have the same name
SERVERNAME.cfg so I cannot copy both files to the import directory at the same time

Is there another way of doing this

Thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by scottwilkerson »

Are you trying to change the hostname or the hostaddress?

Generally you wouldn't need to re-add the services unless you are changing the hostname,.

Changing the hostname can be more easily accomplished through the CCM -> Tools -> Bulk Renaming Tool
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by mccrakem »

Hi

I have figured out how to change the hosts entries
Some of the hosts entries are configured as such

Hostname = SERVERNAME

Address = IP ADDRESS

So by using the Import config files tool I can modify the hosts entries changing the Address from IP Address to hostname and them importing the file which updates the CFG file in the Hosts Directory

But some of the services are configured like so
-f ok -I <IPADDRESS> -u '/api/health' -S -p 9444

So I want to change the IP ADDRESS to HOSTNAME
but everytime I try this with the Import Config Files Tool it does not chnage the CFG files in the services folder

Thanks
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by tgriep »

When you import the service config file with the hostname in the command, is the Overwrite Database box checked when importing so it will overwrite the existing check?

Are the files and service description using the same name and description as the existing services?

Do you Apply the Configuration after the import so XI will write the changes to the cfg files in the services folder?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by mccrakem »

Hi

Yes the Hosts and the Services cfg files have the same name SERVERNAME,CFG
So I have to do the Hosts and then when finished I have to do the services

But When I do the services nothing changes

Yes the Overwrite database box is checked
Yes I do the apply configuration even thou the GUI does not show configuration needing to be applied as it does not see any changes

Thanks
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by tgriep »

Can you post one of the original service configs and the same config that has been edited so we can see if it can be recreated?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by mccrakem »

Hi
I'm not really sure on what files you are looking for as in "original service configs"

can you specify

thanks
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by tgriep »

I am referring to a service configuration file before they were edited to use the Hostname.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by mccrakem »

Hi

Sorry about this but i ran another test this morning, so I could grab some screenshot to show what was going on
But it actually work this time maybe the previous time it di work I just did not notice

On the system I tested this morning the services that were configured with the IP Addresses
what the import tool did was make a copy of them and configure them with the Hostname
so instead of having 2 services we then had 4

but it did work, thanks for your help and you can close this request

Thanks
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Changing from IP Addresses to Hostnames in Services cfg

Post by tgriep »

Locking post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked