What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How to bulk change the IP address of devices?

Votes:

0

Hello,

Within our organization in a few weeks time we'll change the IP addresses of all our servers. Because we want to opt out DNS, in prtg we have created all our devices based on IP and not hostname so we need to rename it there also.

We have a list of the old and new IP address. Is there a way to bulk change this? For starting it would be nice to know where PRTG stores this data.

Best, Steven

address api bulk configuration host hostname prtg script settings

Created on Oct 22, 2015 1:49:12 PM

Last change on Jun 20, 2016 8:17:46 AM by  Luciano Lingnau [Paessler]



Best Answer

Accepted Answer

Votes:

1

Updating a device's address(IP, FQDN or NetBios, the Address field is always the same) only having the device's old and new address consists of two distinct operations:

1. Since all API operations have to be done based on the ID of the object that you want to change, you have to look for the objects with the current address to find their ID's first, if you were looking for the device with address 1.2.3.4:

/api/table.xml?content=devices&output=xml&columns=objid,probe,device,host&filter_host=1.2.3.4

Or if you wanted to partially match a hostname "myserver" but with variations (myserver, myserver.domainx, myserver.domainy) :

api/table.xml?content=devices&output=xml&columns=objid,probe,device,host&filter_host=@sub(myserver)

The query above would return something like:

<?xml version="1.0" encoding="UTF-8"?>
  <devices totalcount="2" listend="1">
   <prtg-version>16.2.24.4274</prtg-version>
   <item>
    <objid>2003</objid>
    <probe>Probe on NEMO-VM2012-2</probe>
    <device>Some Device</device>
    <host>myserver</host>
   </item>
   <item>
    <objid>2236</objid>
    <probe>My Local probe</probe>
    <device>Some Other Device</device>
    <host>myserver.domainx</host>
   </item>
  </devices>

2. Now, we have to use the previously acquired ID's (2003, 2236) to issue the setobjecproperty operation to effectively change the address. For instance if we were to update the address of "Some Device" (ID: 2003) to newaddress.xyz we would issue the following:

/api/setobjectproperty.htm?id=2003&name=host&value=newaddress.xyz

To modify several addresses, implement a repetition mechanism that goes trough all resulting ID's and changes them to the new address using the setobjecproperty for every result of the table.xml?content=devices query.

The API will also require you to provide an username and password or passhash for authentication, an introduction to using the API is available here.

If you're looking for a working example for changing the domain in device's names in bulk using a powershell script, you can check out this: KB: Change Device Name Using Script



Best Regards,
Luciano Lingnau [Paessler Support]

Created on Jun 20, 2016 8:16:18 AM by  Luciano Lingnau [Paessler]

Last change on Jul 5, 2022 9:01:25 AM by  Luciano Lingnau [Paessler]



3 Replies

Votes:

0

Good question, I have the same issue! Only difference may be the setup of PRTG. We have multiple probes and a central PRTG server.

Created on Oct 22, 2015 2:00:38 PM



Votes:

0

Hi,
This might get a longer one. :) So for starters, all configuration data is stored in the file PRTG Configuration.dat (details here). The file is a XML file so to change all IP adresses the easiest way would be replacing all IPs in the config file. Downside here is it is easily possible to break the file. So if you want to try this I would totally recommend using a backed up file and spin up a trial PRTG installation to test with the changed file.

Within the file search for the tag <host> which is holding the IP address of each device. You can try changing the IPs there and then start your trial installation with the edited config to see if everything comes up properly. The other way would be using the PRTG API to change the IPs there. The API documentation can be found here.
Best regards

Created on Oct 23, 2015 1:25:22 PM by  Konstantin Wolff [Paessler Support]

Last change on Jun 20, 2016 8:16:55 AM by  Luciano Lingnau [Paessler]



Accepted Answer

Votes:

1

Updating a device's address(IP, FQDN or NetBios, the Address field is always the same) only having the device's old and new address consists of two distinct operations:

1. Since all API operations have to be done based on the ID of the object that you want to change, you have to look for the objects with the current address to find their ID's first, if you were looking for the device with address 1.2.3.4:

/api/table.xml?content=devices&output=xml&columns=objid,probe,device,host&filter_host=1.2.3.4

Or if you wanted to partially match a hostname "myserver" but with variations (myserver, myserver.domainx, myserver.domainy) :

api/table.xml?content=devices&output=xml&columns=objid,probe,device,host&filter_host=@sub(myserver)

The query above would return something like:

<?xml version="1.0" encoding="UTF-8"?>
  <devices totalcount="2" listend="1">
   <prtg-version>16.2.24.4274</prtg-version>
   <item>
    <objid>2003</objid>
    <probe>Probe on NEMO-VM2012-2</probe>
    <device>Some Device</device>
    <host>myserver</host>
   </item>
   <item>
    <objid>2236</objid>
    <probe>My Local probe</probe>
    <device>Some Other Device</device>
    <host>myserver.domainx</host>
   </item>
  </devices>

2. Now, we have to use the previously acquired ID's (2003, 2236) to issue the setobjecproperty operation to effectively change the address. For instance if we were to update the address of "Some Device" (ID: 2003) to newaddress.xyz we would issue the following:

/api/setobjectproperty.htm?id=2003&name=host&value=newaddress.xyz

To modify several addresses, implement a repetition mechanism that goes trough all resulting ID's and changes them to the new address using the setobjecproperty for every result of the table.xml?content=devices query.

The API will also require you to provide an username and password or passhash for authentication, an introduction to using the API is available here.

If you're looking for a working example for changing the domain in device's names in bulk using a powershell script, you can check out this: KB: Change Device Name Using Script



Best Regards,
Luciano Lingnau [Paessler Support]

Created on Jun 20, 2016 8:16:18 AM by  Luciano Lingnau [Paessler]

Last change on Jul 5, 2022 9:01:25 AM by  Luciano Lingnau [Paessler]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.