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?


Article Comments

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.


May, 2013 - Permalink

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


Oct, 2014 - Permalink

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.


Apr, 2016 - Permalink

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


Mar, 2017 - Permalink

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]


Mar, 2017 - Permalink