Hi Paessler
I have a http url which would return the below json file. Just want to setup a sensor that would check the value of name2:389/monitor if it's equal "available". I tried with HTTP XML/Rest vaule sensor but it could not pick up the node value as name2:389/monitor. The error it returning is "389/monitor' has an invalid token.", I believe this might be because of the ":" character.
Could you please advise if there is a way to work around this?
{ "name1:389": { "admin": "enabled", "connections": 14, "ip": "1.1.1.1.1.1.1", "monitor": "available" }, "name2:389": { "admin": "enabled", "connections": 9, "ip": "1.1.1.1.1.1.1", "monitor": "available" }, "name3:389": { "admin": "enabled", "connections": 12, "ip": "1.1.1.1.1.1", "monitor": "available" }, "up": 3 }
Thanks and regards
Article Comments
Hi Stephan,
Thank you for your help, I'm able to get the sensor to return a value. However, I'm not sure if it's working properly as it return value 0 (or "Monitor unavailable" base on the look up file) even though the value is available.
Node //*[name()='toyent01.389']/monitor[text()='available'] holds value available.
I'm guessing [text()='available']
is where it try to match the value?
So I tried changing the node to see the return int value
//*[name()='toyent01.389']/monitor[text()='notavailable']
and got the below message
Node //*[name()='toyent01.389']/monitor[text()='notavailable'] not found in xml result.
Could you please advise if I'm missing? If this is not possible to achieve with this sensor, is there any other out-of-the-box options that I can set this up? or would it be better to write a custom exe for this?
Mar, 2017 - Permalink
My bad - did you actually set the setting "Sensor Value" to
Use the number of occurrences of the selected XML node or its children/siblings? Then my attempt will work :)
Mar, 2017 - Permalink
Hi Stephan,
Sorry for the late response, it's working now after I change the "Sensor Value" as you advised.
Thanks you very much for your help
May, 2017 - Permalink
You can't do string comparisons in this sensor. Simply use the following:
//*[name()='name2:389']/monitor[text()='available']
...and the following lookup:
Mar, 2017 - Permalink