Consuming RESTful HTTP/XML APIs With a PRTG Sensor

 Published by Dirk Paessler
Last updated on March 03, 2022 • 4 minute read

With a new custom sensor (created by our friend Gerard Feijth) it is now possible to use data from REST-like APIs as sensor data in PRTG. The sensor requests data from an HTTP or HTTPS URL (using GET), parses the XML results and uses selected data from the XML as sensor value in PRTG.

consuming restful httpxml apis with a prtg sensor
With this technique you can import data from many APIs into PRTG, as long as they are offering an interface that works with simple HTTP GETs and replies with XML data. Services like these are often called “REST APIs or RESTful APIs”. This type of API is becoming more and more common, PRTG's own API is a RESTful API, too. Here are a few samples what we can do with this sensor: 

  • Monitor the number of new and open tickets in our support ticket system (Fogbugz by FogCreek Software) in order to display the number in our company Intranet dashboard
  • Monitor current weather conditions using Google.com, Wheatherbug.com, and www.weather.com, in order to control our datacenter cooling system by tracking outside and inside temperatures.
  • Monitor the ranking of our domain Paessler.com on Compete.com
  • Monitor the number of views of a photo of my photostream on Flickr.com, just for fun

Step-by-Step

  • 1. Download the "XMLValue" sensor from http://code.google.com/p/prtg-addons/wiki/PTF_Custom_Sensors
  • 2. Place the "xmlvalue.exe" file from your download into the folder PRTG Network Monitor\custom sensors\EXE of your PRTG installation (or into the same folder on your remote probe, if you want to use the sensor on a remote probe)
  • 3. Create a new custom EXE sensor and select "xmlvalue.exe" as the exe file
  • 4. Supply the necessary URL parameters for the sensor
The last step is obviously the most complex and requires a good knowledge of the API and the XML output. We have compiled knowledge base article "Can I consume Restful XML/HTTP APIs with PRTG (i.e. use their results as sensor values)?" with sample setups. Note 1: Please understand that we can not support this "unofficial" feature as we do with all "official" features of PRTG, but we will try to do our best. Note 2: Here is a nice article that I found while researching for this blogpost: How I Explained REST to My Wife Note 3: Thanks Gerard for developing this sensor and giving it to the community