New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


How to bulk change the IP address of devices?

Votes:

0

Your Vote:

Up

Down

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 by  s1990 (0) 1

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



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

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.

Best Regards,
Luciano Lingnau [Paessler Support]

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

Last change on Jul 24, 2018 7:54:32 AM by  Brandy Mauff [Paessler Support]



3 Replies

Votes:

0

Your Vote:

Up

Down

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 by  SwissKnife (0)



Votes:

0

Your Vote:

Up

Down

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 Support]



Accepted Answer

Votes:

0

Your Vote:

Up

Down

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.

Best Regards,
Luciano Lingnau [Paessler Support]

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

Last change on Jul 24, 2018 7:54:32 AM by  Brandy Mauff [Paessler Support]



Please log in or register to enter your reply.


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.