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 can I get multiple values from single HTTP XML/REST Value Sensor

Votes:

0

How can I achieve to get multiple values (or sensors) from single HTTP XML/REST call?

My XML has a lot of data and I want to graph several values but not to make separate call for each value since it unnecessary strains my application server.

for example:

<data>
<section1>
    <name>int. Temperature</name>
    <value_int>2631</value_int>
</section1>
<section2>
    <name>out. Temperature</name>
    <value_int>3734</value_int>
</section2>
</data> 

How do I graphs in a single call section1/value_int

and

section2/value_int?

http-xml rest xpath

Created on May 18, 2013 7:33:06 AM

Last change on Apr 26, 2016 11:42:29 AM by  Luciano Lingnau [Paessler]



5 Replies

Votes:

0

This is not possible at the moment. Other customers have had the same wish before and we'll count your vote for this feature. At the moment, we can't tell you if and when it will be implemented, but it will most likely not be within the next few months.

As a workarround, you can add two HTTP XML/REST sensors, one for every value and then use a Factory Sensor, to show both graphs within one sensor.

Created on May 21, 2013 4:31:23 PM by  Johannes Herrmann [Paessler Support] (1,360) 2 2



Votes:

0

Count me in. This feature would be really nice to have.

Created on Oct 9, 2014 9:20:53 AM



Votes:

0

It's possible to query multiple XML encoded values via HTTP within a single sensor but the XML document MUST comply to PRTG's "custom sensor xml format". For instance, the XML below is the "bare minimum" for a multi-channel XML sensor:

<?xml version="1.0"?>
<prtg>
<result>
<channel>Total</channel>
<value>12</value>
</result>
<result>
<channel>My Channel 0</channel>
<value>5</value>
</result>
<result>
<channel>My Channel 1</channel>
<value>3</value>
</result>
<result>
<channel>My Channel 2</channel>
<value>0</value>
</result>
<result>
<channel>My Channel N</channel>
<value>2</value>
</result>
</prtg>

The HTTP Data Advanced Sensor sensor can be deployed an targeted at the URL which contains the XML data, the sensor's channels are created dynamically and additiona options (unit, type, limits and several additional properties can be defined as per our Application Programming Interface for custom sensors.

Created on Apr 26, 2016 12:39:17 PM by  Luciano Lingnau [Paessler]

Last change on Jul 24, 2018 7:43:41 AM by  Brandy Greger [Paessler Support]



Votes:

0

Hi i would like to know the way to access the same way that Luciano mention for the XML, but i wanna use JSON. Attached the JSON File as a example.

{
   "cdn.headroom" : 29,
   "cdn.machines" : [
      {
         "headroom" : 29,
         "hostname" : "ia1.tp2sfe1d1.cdn",
         "ips" : [ "10.187.9.20" ],
         "max-headroom" : 100,
         "rack" : "r.mx.sfe.tp2sfe1c1"
      }
   ],
   "cdn.max-headroom" : 100,
   "external.headroom" : 2029,
   "external.machines" : [
      {
         "headroom" : 91,
         "hostname" : “hostname1”,
         "max-headroom" : 100,
      },
      {
         "headroom" : 89,
         "hostname" : "hostname2”,
         "max-headroom" : 100,
      },
      {
         "headroom" : 92,
         "hostname" : "hostname3”,
         "max-headroom" : 100,
      },
      {
         "headroom" : 79,
         "hostname" : "hostname4”,
         "max-headroom" : 100,
      },
      {
         "headroom" : 80,
         "hostname" : "hostname5”,
         "max-headroom" : 100,
      },
      {
         "headroom" : 96,
         "hostname" : "hostname6”,      
         "max-headroom" : 100,
      }
   ],
   "external.max-headroom" : 2600
}

I'm looking for extract the value of headroom in every external.machine[] array , in this case i will expect 91 , 89 . 92 . 79 , 80 , 96

Created on Mar 21, 2017 4:35:23 PM



Votes:

0

Hello,
thank you for your reply.

You can use JSON in Custom Advanced PRTG sensors as well, but they need to comply with the format that PRTG's API expects:

{
  "prtg": {
    "result": [
      {
        "channel": "Total",
        "value": "12"
      },
      {
        "channel": "My Channel 0",
        "value": "5"
      },
      {
        "channel": "My Channel 1",
        "value": "3"
      },
      {
        "channel": "My Channel 2",
        "value": "0"
      },
      {
        "channel": "My Channel N",
        "value": "2"
      }
    ]
  }
}

Please beware however that the XML/Rest Value sensor is NOT MULTICHANNEL, to monitor all six values you will either need six individual HTTP XML/Rest Value sensors or a single Custom Advanced sensor that parses the output and converts it to a value that complies with PRTG's API for custom sensors.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Mar 22, 2017 1:55:52 PM by  Luciano Lingnau [Paessler]




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.