Receiving json-data over http-service
-
Hi together,
I need some help with this data:
That data comes from a software logger over http-service in json-fomat. I need the two parameters under "tuples": [(timestamp, value)]. Some suggestions? I was trying out some variants of data sources, but it didn´t worked.
Regards
Sasa -
sasa,
I would suggest using the HTTP Retriever data source and setting up data points with the appropriate regex patterns to extract the values for the points. Basically point the HTTP Retriever at the URL you need and then setup 2 Numeric points with regex setup to extract each of the values from "tuples".
Here is some regex that sort of works for a simple test but you may need to tweak it a little:
.*"tuples": [ \{ ([0-9]+), ([0-9]+).*}.*
You can test your regex here or any of the many sites that allow testing regex patterns:
http://regex-testdrive.com/ -
Terry,
thank you for your help. I used the type "HTTP Retriever" where it is possible to create points by choosing the groups of the matched regular expression (now I understand the functionallity ;-)). I had to change the expression a little bit. Here is the working implementation as example for others and documentation.
Regular Expression
.*"tuples": [ [ ([0-9]+), ([0-9]+\.[0-9]+).] ] \} ] \}
Target string:
{ "version": "0.5.1", "generator": "vzlogger", "data": [ { "uuid": "123", "last": 1470924327196, "interval": 5, "protocol": "d0", "tuples": [ [ 1470924327195, 115.185 ] ] } ] }
Matcher
group(0) { "version": "0.5.1", "generator": "vzlogger", "data": [ { "uuid": "123", "last": 1470924327196, "interval": 5, "protocol": "d0", "tuples": [ [ 1470924327195, 115.185 ] ] } ] }
group(1) 1470924327195
group(2) 115.185
Configuration in Mango for choosing the value group 2 (115.185)
.Value in the watchlist
.
Thank you very much!
Sasa