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 can i link the device IP in the map?

Votes:

0

Your Vote:

Up

Down

Hi all PRTG support,

I would like to know how to show device IP in the map by using default icon set. By default the default map object only show the device name which is not clear for presenting the network diagram.

If it is not possible to achieve by default icon set, could i create my own set of mapobject to achieve this features? If the answer is yes, is there is any resource for using PRTG script like the following

<#objectproperty type="nodename" id="<@objectid>" var="nodename">

I haven't find any complete reference for using # and @ syntax and how they map to deviceIP.

Thank a lot

custom map mapobject

Created on Aug 10, 2015 7:15:31 AM by  twinsen123 (0) 1



3 Replies

Votes:

0

Your Vote:

Up

Down

Unfortunately, there's no such item available PRTG and you have to build it yourself. Here's an object that displays comments of an object: IP in Maps
Since this is not generated automatically, you'll neeed a script that iterates through the devices and puts the IP address in the comment of it:

[xml]$Devices = (New-Object System.Net.WebClient).DownloadString(http://<your-prtg-server>/api/table.xml?content=devices&output=xml&columns=objid,host&username=<prtg-user>&passhash=<passhash>)
foreach($Device in $Devices.Item) 
{ 
    $ips = [System.Net.Dns]::GetHostAddresses("$Device.Host")
    Invoke-WebRequest "http://<ihr-prtg-server>/api/setobjectproperty.htm?id=$Device.Objid&name=Comments$value=$ips[1].IPAddressToString&username=<prtg-user>&passhash=<passhash>"
} 

This is just a proof of concept and probably needs some tweaking. What it basically has to do:

  1. Retrieve list of all devices via PRTGs API.
  2. Parse the XML into a PowerShell object
  3. Resolve the host for each object
  4. Put the IPv4 string into the comment device

Create a new map object (e.g. C:\Program Files (x86)\PRTG Network Monitor\webroot\mapobjects\device_comment.htm) with the following code:

<!-- Devices: Device comment -->
<div class="map_object" id="<@itemid>" objectid="<@objectid>" subid="<@subid>" style="<#mapobject type="coordinates" subid="<@subid>" mode="<@editmode>">">
  <#mapobject type="objectgrip" mode="<@editmode>">
  <#mapobject type="htmlbefore" subid="<@subid>">
  <#checkobjecttype objecttype="device" nicemessage="true" id="<@objectid>">
  <#objectstatus name="comments"  id="<@objectid>">
  <#mapobject type="htmlafter" subid="<@subid>">
</div>

This will show the device comment as simple text on the map as shown above. Add <b>IP: </b> to the HTML Before field of the object to prepend some text to it.

Created on Aug 11, 2015 6:47:18 AM by  Stephan Linke [Paessler Support]

Last change on Nov 25, 2015 7:02:11 PM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Where does this go?

[xml]$Devices = (New-Object System.Net.WebClient).DownloadString(http://<ihr-prtg-server>/api/table.xml?content=devices&output=xml&columns=objid,host&username=<prtg-user>&passhash=<passhash>) foreach($Device in $Devices.Item) { $ips = [System.Net.Dns]::GetHostAddresses("$Device.Host") Invoke-WebRequest "http://<ihr-prtg-server>/api/setobjectproperty.htm?id=$Device.Objid&name=Comments$value=$ips[1].IPAddressToString&username=<prtg-user>&passhash=<passhash>" }

Created on Nov 25, 2015 4:22:07 PM by  dreniarb (10) 1



Votes:

0

Your Vote:

Up

Down

This script needs to be executed with a scheduled task like every 30 minutes, depending on how up to date you want the IPs to be :)

Created on Nov 25, 2015 7:32:17 PM by  Stephan Linke [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.