I'm using an HTTP Data Advanced sensor to monitor some JSON, containing several channels. In theory, this JSON should be overwritten every 5 minutes with new, so the sensor runs every 5 minutes too. However, in reality the JSON is not always overwritten.
In order to know when the results in PRTG are from, I'd like to add a channel to the JSON names something like "Query Time (UTC)". How can I successfully add this channel?
Attempt 1 - just throw the date in
However, doing this without any additional parameters in the JSON causes the sensor to fail (not unexpectedly) -
The returned JSON does not match the expected structure ('2018-08-01T10:49:26.0Z' is not a valid integer value). (code: PE231)
{ "prtg": { "result": [ { "channel": "Query Time (UTC)", "value": "2018-08-01T10:49:26.0Z" }, {...}, {...}, {...} ] } }
Attempt 2 - use the 'Custom' unit type
I've also tried to include the "unit" and customUnit parameters, but that leads to another error -
The returned JSON does not match the expected structure ('1 Aug 2018). (code: PE231)
{ "prtg": { "result": [ { "channel": "Query Time (UTC)", "value": "1 Aug 2018, 10:49 AM", "unit": "Custom", "CustomUnit": "UTC" }, {...}, {...}, {...} ] } }
Attempt 3 - use the 'duration' function
After some research, I came across the 'duration' function. It's not clear from the documentation exactly where it can be used, so I thought I'd give it a go, but that failed too -
The returned JSON does not match the expected structure ('duration(2018-08-01T10:49:26.0000000Z). (code: PE231)
{ "prtg": { "result": [ { "channel": "Query Time (UTC)", "value": "duration(2018-08-01T10:49:26.0000000Z, now())" }, {...}, {...}, {...} ] } }
Add comment