Page 1 of 1

Change Host IP address to host name

Posted: Tue Nov 27, 2018 2:06 pm
by hlaten01
I am looking for help, hopefully a script, on changing the Host IP address that is located for each device in host management to the host name which is the fqdn of each device, thus not using the IP address in the address label. This will help in each server not having to have it's IP address changed during our Greenfield move or if we change IP addresses on a device and we then can be a truly use DNS for our monitoring. Running Nagios XI from OVA file to VMWare. Nagios XI 5.5.7.

Re: Change Host IP address to host name

Posted: Tue Nov 27, 2018 4:37 pm
by npolovenko
Hello, @hlaten01. We don't have a script to automate this process. How many hosts are you looking to modify?

You could write our own script that takes care of that or contact the sales departmement to get a quote for a custom developement. The order of changing the configs would probably look like this.
mkdir /backup
cp /usr/local/nagios/etc/hosts/* /backup
cp /usr/local/nagios/etc/hosts/* /usr/local/nagios/etc/import/

**Your script replaces all hostaddress fields with hostname fields in all host configs in the /usr/local/nagios/etc/import/ folder.

cd /usr/local/nagiosxi/scripts/
./reconfigure_nagios.sh
Other then that, the only solution is to manually change the hostadress fields for each host.

Re: Change Host IP address to host name

Posted: Wed Nov 28, 2018 8:18 am
by hlaten01
Thank you for the information. Weird that this has not been ask yet by anyone else under support contract. I have right at 450 host that need to be converted.

Re: Change Host IP address to host name

Posted: Wed Nov 28, 2018 4:59 pm
by npolovenko
@hlaten01, Actually, try changing the host check command to use the $HOSTNAME$ instead of $HOSTADDRESS$. Go to commands, find the command that is used for all host checks and replace the macro.