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
Article Comments
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:

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:
- Retrieve list of all devices via PRTGs API.
- Parse the XML into a PowerShell object
- Resolve the host for each object
- 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.
Aug, 2015 - Permalink
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>"
}
Nov, 2015 - Permalink
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:
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:
This is just a proof of concept and probably needs some tweaking. What it basically has to do:
Create a new map object (e.g. C:\Program Files (x86)\PRTG Network Monitor\webroot\mapobjects\device_comment.htm) with the following code:
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.Aug, 2015 - Permalink