New Question
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

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

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

Count all child elements 1 level deep



Your Vote:



Is it possible to count all the child elements directly under an icon? All types of child elements should be considered (devices and groups).

customize maps status-icons

Created on Apr 13, 2015 11:42:15 AM by  JJStr (0) 1

2 Replies

Accepted Answer



Your Vote:



I guess your best starting point is the table.xml API call


You can limit the result set by including the objectID of the parent 'icon'


'Feeding' the url above to the HTTP XML/Rest Value Sensor using XPath query sensortree/nodes/*[1] and selecting Count Child Nodes will give you the number of child elements +7

The +7 is caused by the additional describing nodes (<name>,<id>,<url>,...) in the xml result.

You might be able to filter out these additional nodes using a more advanced XPath query.

Created on Apr 13, 2015 3:13:29 PM by  PRTG Tools Family [] (13,163) 3 4



Your Vote:



Thanks for your response.

However with this approach, we have to create an additional sensor for the counting on each of the affected groups and we lose the status color of the group on the icon.

Based on your suggestions, I have implemented this using jQuery code in the icon template:

<span id="count<@objectid>"/>

    $.get("https://yourserver/api/table.xml?content=sensortree&id=<@objectid>", function(data) {
      $('#count<@objectid>').text($('sensortree > nodes > :first-child > :has(*)', data).length);

Created on Apr 16, 2015 4:36:20 PM by  JJStr (0) 1

Last change on Apr 16, 2015 6:36:31 PM by  Torsten Lindner [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.