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

Are there limitations to the custom HTML maps element?




I've been playing around a little with the Custom HTML Element in the Maps designer. When i selct a sensor on the left pane and then drag the element onto the map it works well. When I enter simple html like <a href="some.link.com">link</a> into the HTML Before field it works perfectly well.

If I do the same with some more complex code like

<script type='text/javascript'>
if(typeof my_custom_id == 'undefined')
    var my_custom_id = 1;
document.writeln('<a id=\'my_custom_id_'+my_custom_id+'\'/>');
var sensor_id = document.getElementById('my_custom_id_'+my_custom_id).parentElement.getAttribute('objectid');
document.write('<a href=\'http://servername/api/getsensordetails.xml?id='+sensor_id+'&username=prtgadmin&passhash=XXXXXXXXXXXXX\'>XML Live data for Sensor #'+sensor_id+'</a>');

it fails. Once I hit the Save-Button, it seems to open a new window in which it tries to execute the code without the context of the map code.

If I take the HTML code of a map and copy it into a new file and then manually add my custom code to the right spot it seems to work. Any idea how I can overcome this and use the HTML Before field to enter the custom code from above? Using PRTG 12.

Thanks for your help in advance.

Kind regards

api custom-html html

Created on May 16, 2012 11:40:56 AM

1 Reply



I'm afraid it is not possible to use Java Script in the HTML Before/After fields of the object properties. But you might consider creating a own map object if you are in need of more complex structures. A detailed guide can be found here.
Best regards

Created on May 16, 2012 12:46:05 PM by  Konstantin Wolff [Paessler Support]

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.