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

How do I extract values from XML

Votes:

0

Hi. I try to get values of array from this XML using PRTG's HTTP XML/REST Value Sensor:

<entry channel="1" enabled="1" present="1">
<item t="text" r="1" d="Channel type">FXO</item>
<item t="text" r="1" d="Line status">Ready</item>
<item t="text" r="1" d="CO Line">Connected</item>
<item t="text" r="1" d="Reg. status">Registered</item>
<item t="int" r="0" d="SIP port">5061</item>
<item t="text" r="0" d="Call type"/>
<item t="text" r="1" d="Status">Idle</item>
<item t="int" r="0" d="Call limit">0</item>
<item t="int" r="0" d="Total duration">0</item>
<item t="text" r="0" d="Memo"/>
</entry>

with the following XML Node field:

entry[@channel='1']/item[@d] 
and I want to get all 'item' ellement in different channels, e.g.:
Channel type = FXO
Line status = Line status....

but now I get in this form:

Value = 0
Message = Node entry[@channel='1']/item[@d] holds value FXO.

Channels:
Downtime		
Execution Time	
Value

prtg9 value xml

Created on Apr 27, 2015 7:12:01 AM

Last change on Apr 27, 2015 9:43:28 AM by  Felix Saure [Paessler Support]



3 Replies

Votes:

0

Hello,

Thank you very much for using PRTG. Please bear in mind, the HTTP XML / REST Sensor can only gather one value in the value channel. Multiple channels are not possible.

best regards.

Created on Apr 28, 2015 10:58:25 AM by  Torsten Lindner [Paessler Support]



Votes:

1

I wrote a program to convert the kind of CML at the right for "XML Custom EXE / Script sensor" in this form:

<result>
    <channel>CO Line</channel>
    <unit>Custom</unit>
    <CustomUnit>CO Line</CustomUnit>
    <Warning>0</Warning>
    <LimitMaxError>4</LimitMaxError>
    <LimitErrorMsg>Not ready</LimitErrorMsg>
    <ValueLookup>prtg.standardlookups.KTS_Status</ValueLookup>
    <value>4</value>
</result>
<result>
    <channel>Reg. status</channel>
    <unit>Custom</unit>
    <CustomUnit>Reg. status</CustomUnit>
    <Warning>0</Warning>
    <LimitMaxError>4</LimitMaxError>
    <LimitErrorMsg>Not ready</LimitErrorMsg>
    <ValueLookup>prtg.standardlookups.KTS_Status</ValueLookup>
    <value>4</value>
</result>
....

Created on Apr 28, 2015 11:05:04 AM

Last change on Apr 28, 2015 12:44:56 PM by  Torsten Lindner [Paessler Support]



Votes:

0

That of course is a very good solution. Glad you could solve this!

Created on Apr 28, 2015 12:45:13 PM by  Torsten Lindner [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.