Good morning!
I am investigating whether PRTG monitoring can be used within our company. I have set up a test environment and can monitor hardware. In addition to hardware monitoring, I would like to show specific sensor data on the dashboards within the expertise center. I want to do this using the HTTP XML / REST value sensor. However, I lack the knowledge to do this.
The XML to be read is:
- <meetdata> <informatie versie="1588146976" /> - <sensor> <naam>BSA1-WSMINUUT</naam> <waarde>495</waarde> <tijd>1588146970</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA1-WRMINUUT</naam> <waarde>2764</waarde> <tijd>1588146970</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA1-WRMIN</naam> <waarde>2672</waarde> <tijd>1588146970</tijd> <kwaliteit>10</kwaliteit> </sensor> + <sensor> <naam>BSA1-WRMAX</naam> <waarde>2939</waarde> <tijd>1588146970</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA1-WSMAX</naam> <waarde>548</waarde> <tijd>1588146970</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA-TAMINUUT</naam> <waarde>93</waarde> <tijd>1588146965</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA-TDMINUUT</naam> <waarde>83</waarde> <tijd>1588146965</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA-PS10GEM</naam> <waarde>9998</waarde> <tijd>1588146975</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA-ZM10GEM</naam> <waarde>8120</waarde> <tijd>1588146976</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA-C1</naam> <waarde>9999</waarde> <tijd>1588146972</tijd> <kwaliteit>1</kwaliteit> </sensor> - <sensor> <naam>BSA-ZV</naam> <waarde>9999</waarde> <tijd>1588146972</tijd> <kwaliteit>1</kwaliteit> </sensor> - <sensor> <naam>BSA-H1d3</naam> <waarde>77</waarde> <tijd>1588146000</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA-U10</naam> <waarde>93</waarde> <tijd>1588146600</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA2-WSMINUUT</naam> <waarde>459</waarde> <tijd>1588146973</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA2-WRMINUUT</naam> <waarde>2601</waarde> <tijd>1588146973</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA2-WRMIN</naam> <waarde>2489</waarde> <tijd>1588146973</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA2-WRMAX</naam> <waarde>2784</waarde> <tijd>1588146973</tijd> <kwaliteit>10</kwaliteit> </sensor> - <sensor> <naam>BSA2-WSMAX</naam> <waarde>519</waarde> <tijd>1588146973</tijd> <kwaliteit>10</kwaliteit> </sensor> </meetdata
The values ??should return wind speeds, temperatures, wave height, etc.
I found and tried tips on different kb's, like the setting below.
XML-node (en optionele eigenschap) naam[1]/waarde
or
naam[1] /waarde
However, I get the error: Node name [1] / value not found in xml result. Or: Object reference not set to an instance of an object.
Can someone steer me in the right direction?
Many thanks in advance!
Kind regards, Ingmar
Article Comments
Thanks for the reply!
I'am trying to use the XML/Rest sensor. I followed some examples but didn't get the info which i expected to get. I tried the following XPATH:
sensor/naam | sensor/waarde
I get this info:
Node sensor/naam | sensor/waarde holds value BSA-H1d3.
I expected the value of 77 instead of the name "BSA-H1d3"
<sensor> <naam>BSA-H1d3</naam> <waarde>77</waarde> <tijd>1588146000</tijd> <kwaliteit>10</kwaliteit> </sensor>
If someone knows the answer, please :) Meanwhile i'am going to try and will report if it works, or not...
Ingmar
May, 2020 - Permalink
In that case, it could be /meetdata/sensor[12]/waarde/text()
Please note this relies on the node position within the XML and might not work as expected.
May, 2020 - Permalink
You are my Hero!
- <sensor> <naam>BSA-H1d3</naam> <waarde>70</waarde> <tijd>1588776000</tijd> <kwaliteit>10</kwaliteit> </sensor>
Gives value 70 whit in PRTG! Thank you very much! Now I have a nice case to buy license :)
Kind regards, Ingmar
May, 2020 - Permalink
Dear Roskami,
the XML/Rest sensor needs the node being provided as Xpath.
As alternative, you can use the Rest Custom sensor. With the "channel discovery" mode, all applicable data is shown.
In order to show only a custom selection, please create the respective definition file in "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\rest" and use this syntax, then create the sensor again and select that definition.
In order to show only one value, using the XML/Rest sensor is easier. You can use online tools to check if your Xpath matches the correct value.
Apr, 2020 - Permalink