What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Interpreting a JSON Response in HTTP XML/Rest Value sensor

Votes:

1

I've got the free version of PRTG running at home, and I've also got quite a few Hue lights, and I was interested in seeing if I could keep tabs of the reachability of the Hue bulbs - for fun, just to try out the possibilities.

The API call to look up a specific light status is as follows:

http://192.168.0.111/api/77DiCq1MBnwE4W9IbIoVonQ65moMIseEuw6ui-sB/lights/10

And this is the JSON response.

{
"state": {
"on": true,
"bri": 254,
"hue": 14956,
"sat": 140,
"effect": "none",
"xy": [
  0.4571,
  0.4097
],
"ct": 366,
"alert": "none",
"colormode": "ct",
"reachable": true
},
"type": "Extended color light",
"name": "Bonus Room Desk",
"modelid": "LCT007",
"manufacturername": "Philips",
"uniqueid": "00:17:88:01:10:5a:79:90-0b",
"swversion": "5.50.1.19085"
}

I was using the HTTP XML/Rest Value sensor to try and test the result - I'd rather not have to write a custom sensor for this. Unfortunately, while I can point at the value for "reachable" with "state/reachable" in the XML Node, I'm not sure how to determine whether the value is "true" or "false".

Ideas?

http json rest

Created on May 26, 2017 8:41:43 PM

Last change on May 29, 2017 7:33:45 AM by  Dariusz Gorka [Paessler Support]



1 Reply

Accepted Answer

Votes:

1

Hi there,

The best way to check if the value at "reachable" is set to "true" is to use the "HTTP Advanced Sensor". There you enable/set the following options:

  • URL: the URL to the JSON-API
  • Require Keyword: Set sensor to error if keyword is missing
  • Response must include: (it's regular expressions, you can test it with Rubular)
"reachable":\strue
  • Check Method: Regular Expressions

Best regards.

Created on May 29, 2017 7:43:20 AM by  Dariusz Gorka [Paessler Support]




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.