This article applies as of PRTG 22
Using XPath with the HTTP XML/REST Value sensor in PRTG
Important Notice:
The syntax provided in this article is not fully compatible with the HTTP XML/REST Value sensor. This sensor type does not officially support the use of XPath. We cannot give you any technical support for XPath issues. This article is provided for your information only.
XPath
In the XML Node (and optional property) setting of the HTTP XML/REST Value sensor, you can try to use XPath. It can enable you to read, for example, values of arrays from .xml files. For example, use array[@name='myName']
to read all 'array' elements that have a 'name' attribute equal to 'myName'. A few more examples:
Get all sensors with a certain status: //status[text()='green']
Get all HTTP-based sensors from the PRTG configuration file (via PowerShell): sensor[@id][data/sensorkind[normalize-space(text())="http"]]
More
- Online XPath Validator
- Find the optimal settings for this sensor with the XML/Rest Query Builder of the PRTG Tools Family
- Details about XPath expressions: XPath Examples
- Windows tool to help you find desired XPath expressions: XPath Visualizer
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.