What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

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

Return a value from JSON output

Votes:

0

Your Vote:

Up

Down

Hi,

Trying to do something I've never done before and don't know much about.

I have a web api returning JSON (I believe) and I need to pull a value out of it for the temperature.

I have been poking around with the XML/REST sensors but am not getting anywhere.

Can anyone point me in the right direction?

in the sample output below, the current temperature is 25.88.

{"id":"161","name":"SmartThings Multipurpose Sensor V5","label":"Lounge Multipurpose","attributes":[{"name":"acceleration","currentValue":"inactive","dataType":"ENUM","values":["inactive","active"]},{"name":"battery","currentValue":85,"dataType":"NUMBER"},{"name":"contact","currentValue":"closed","dataType":"ENUM","values":["closed","open"]},{"name":"temperature","currentValue":25.88,"dataType":"NUMBER"},{"name":"threeAxis","currentValue":null,"dataType":"VECTOR3"}],"capabilities":["TemperatureMeasurement",{"attributes":[{"name":"temperature","dataType":null}]},"Battery",{"attributes":[{"name":"battery","dataType":null}]},"ContactSensor",{"attributes":[{"name":"contact","dataType":null}]},"Configuration","ThreeAxis",{"attributes":[{"name":"threeAxis","dataType":null}]},"AccelerationSensor",{"attributes":[{"name":"acceleration","dataType":null}]},"Refresh","Sensor"],"commands":["configure","refresh"]}

code json xml

Created on Dec 29, 2019 9:14:18 AM by  TheatrePerson (0) 1



2 Replies

Accepted Answer

Votes:

2

Your Vote:

Up

Down

You can do this using the https://www.paessler.com/manuals/prtg/http_xmlrest_value_sensor

For the XML Node value enter:

//attributes[name='temperature']/currentValue

Sensors | Multi Channel Sensors | Tools | Notifications

Kind regards,

[[http://prtgtoolsfamily.com]] PRTG Tools Family

Created on Dec 30, 2019 9:35:14 AM by  PRTG Tools Family [prtgtoolsfamily.com] (13,273) 3 4



Votes:

0

Your Vote:

Up

Down

Thank you very much, this works and I now understand the syntax better. :)

Created on Dec 30, 2019 12:48:38 PM by  TheatrePerson (0) 1



Please log in or register to enter your reply.


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.