change switch IP

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
MelsStudios
Posts: 19
Joined: Thu May 07, 2020 9:28 am

change switch IP

Post by MelsStudios »

Hello,

We monitor many switches with nagiosXI,

We are doing some changes on our network and will modify some switches IPs.

If I change the IP for the host within the CCM, the change will not apply to it's services ( ports ) then my dashbord won't be accurate and all.


Is there a way to change the IP in the services configuration ?
I looked into the bulk modification tool but I'm not sure it is what I need, or maybe I do not understant how I can do it with that tool.

Thanks !
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: change switch IP

Post by ssax »

The easiest way would be to remove/readd it with the switch wizard again.

If you really want to redo them, this would be the process:

You would need to do four things:

1. Modify the host in Configure > Core Config Manager > Hosts.

2. Rename the files in /var/lib/mrtg:
- Change all occurrences of X.X.X.X to the old IP, change all occurrences of Y.Y.Y.Y to the new IP

Code: Select all

rename X.X.X.X Y.Y.Y.Y /var/lib/mrtg/*.rrd
3. Modify the MRTG config file for the switch in /etc/mrtg/conf.d for the device as well to change the IP.
- Change all occurrences of X.X.X.X to the old IP, change all occurrences of Y.Y.Y.Y to the new IP

Code: Select all

sed -i 's/X.X.X.X/Y.Y.Y.Y/g' /etc/mrtg/conf.d/X.X.X.X.cfg
4. Update the bandwidth services to change the $ARG1$ value from:

Code: Select all

X.X.X.X_ZZZZ.rrd
To:

Code: Select all

Y.Y.Y.Y_ZZZZ.rrd
You can either do that manually or do something like this then apply config:
- Change all occurrences of X.X.X.X to the old IP, change all occurrences of Y.Y.Y.Y to the new IP

NOTE: BEFORE YOU RUN THIS, MAKE SURE YOU HAVE AN XI BACKUP as directly interacting with the DB can cause issues if you're not very careful with the commands.

Code: Select all

mysql -h 127.0.0.1 -uroot -pnagiosxi nagiosql -e 'UPDATE tbl_service SET check_command = REPLACE(check_command, "X.X.X.X", "Y.Y.Y.Y") WHERE check_command LIKE "%X.X.X.X_%.rrd%";'
Note: You can always revert to a config snapshot in Admin > Config Snapshot if you have any issues.
MelsStudios
Posts: 19
Joined: Thu May 07, 2020 9:28 am

Re: change switch IP

Post by MelsStudios »

Thanks for you solutions,

I have many dashboards for many users, If I remove / re-add with the switch wizard, will the dashboard get updated with the new IP ? or I will have to re-do every dashboards ?

Thanks !
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: change switch IP

Post by ssax »

I think it would only impact it if you also change the hostname (instead of just the address).

If you change hostname or servicename it will impact the historical data and dashboards.
MelsStudios
Posts: 19
Joined: Thu May 07, 2020 9:28 am

Re: change switch IP

Post by MelsStudios »

All right, Thank you for your help,

that answered my question.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: change switch IP

Post by benjaminsmith »

Hello @MelsStudios,
All right, Thank you for your help,
Glad we could help. We'll close this thread out. Feel free to open another if you have any new questions.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

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