New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

150.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 do I extract values from XML nodes (with nested tags) using PRTG's XML/Rest Value Sensor?

Votes:

0

Your Vote:

Up

Down

How exactly do I extract values from XML node using PRTG's HTTP XML/REST Value Sensor?

help http http-xml node restful sensor value xml xml-rest xml-rest-value

Created on Nov 5, 2012 4:01:34 PM by  Daniel Zobel [Paessler Support]

Last change on Jun 26, 2015 12:03:23 PM by  Luciano Lingnau [Paessler Support]



5 Replies

Accepted Answer

Votes:

0

Your Vote:

Up

Down

This article applies to PRTG Network Monitor 12 or later

Extracting XML Nodes

The "HTTP XML/Rest Value Sensor" can parse different XML outputs. The notation is XPath compatible. For details, please see PRTG Manual: HTTP XML/REST Value Sensor.

Please find a typical simple XML example below.

<data>
<section1>
    <name>int. Temperature</name>
    <value_float>36.31</value_float>
    <value_int>3631</value_int>
    <value_string>thirty-six</value_string>
    <minimum>36.25</minimum>
    <maximum>46.87</maximum>
    <limit_low>10.00</limit_low>
    <limit_high>50.00</limit_high>
    <function>l</function>
    <alarm1>0</alarm1>
</section1>
</data> 

Data from Nested XML Tags

In order to obtain values from nested XML tags, use tag names separated by a slash. So, in order to obtain the float value 36.31 from the XML above you would use the following value in the sensor's XML Node field:

section1/value_float


See Also

Created on Nov 5, 2012 4:17:27 PM by  Daniel Zobel [Paessler Support]

Last change on Nov 6, 2012 9:35:28 AM by  Daniel Zobel [Paessler Support]



Votes:

0

Your Vote:

Up

Down

When there are multiple nodes within a XML result, you can reference it's occurrence using a number between Brackets.

The following PRTG API Call For example:

/api/table.xml?content=sensors&output=xml&columns=name,uptime&id=DEVICEID

Produces the following output:

<?xml version="1.0" encoding="UTF-8"?>
  <sensors totalcount="2" listend="1">
   <prtg-version>15.2.18.2816</prtg-version>
   <item>
    <name>Ping</name>
    <uptime>95,3760%</uptime>
    <uptime_raw>000000000953760</uptime_raw>
   </item>
   <item>
    <name>Traceroute Hop Count</name>
    <uptime>95,4608%</uptime>
    <uptime_raw>000000000954608</uptime_raw>
   </item>
  </sensors>

If we want to read the uptime for the Traceroute Hop Count in the XML result, we use the following syntax within the XML Node (and optional property) inside PRTG:

item[2]/uptime

That will result in the folowing output within the HTTP XML/REST Value Sensor in PRTG

Node item[2]/uptime_raw holds value 95,4608%.

Created on Jun 26, 2015 11:43:28 AM by  Luciano Lingnau [Paessler Support]

Last change on Jun 26, 2015 12:02:22 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi,

With your example, is it possible to get the totalcount value ?

Thanks,

Matthieu

Created on Nov 14, 2016 4:58:13 PM by  Matthieu Noirbusson (8) 1



Votes:

0

Your Vote:

Up

Down

Hi there,

It's not possible to get the value of <sensors totalcount="353" listend="1"> because it is not a value of a node. You could however count the number of <item> occurrences.


Best Regards,
Luciano Lingnau [Paessler Support]

Created on Nov 15, 2016 2:39:52 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi there,

It's not possible to get the value of <sensors totalcount="353" listend="1"> because it is not a value of a node. You could however count the number of <item> occurrences.


Best Regards,
Luciano Lingnau [Paessler Support]

Created on Nov 15, 2016 2:39:52 PM by  Luciano Lingnau [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.