Hi guys,
I'm trying to get a detailed history of device statistics out of the PRTG API. I'm using this query to pull channel values by datetime:
/api/table.json?content=values&output=json&columns=datetime,value_,coverage&id=14129
I'd like to do that, but for all channels of a device. I'd like to specify a list of sensors, then have data returned in something along the lines of the following:
/api/table.json?content=values&output=json&columns=datetime,value_,coverage&id=14130,14131,14132 sensorID / datetime / value / downtime / coverage
This would result in a long json object, but the software I'm using (PowerBI) is then able to slice that file up by a given object ID (in this case, the sensor identifier). Currently I'm doing this by doing a lot of the former query (single sensor values) and merging those tables, but this is becoming unwieldy - I have 50+ sensors we're pulling data from.
Thanks!
Cameron
Article Comments
Hi Sven,
I'd like a list of historical values for a list of given sensor IDs. I guess the best way I can summarise that is to get a concatenated list of the below queries:
/api/table.json?content=values&output=json&columns=datetime,value_,coverage&id=14129 /api/table.json?content=values&output=json&columns=datetime,value_,coverage&id=14130 /api/table.json?content=values&output=json&columns=datetime,value_,coverage&id=14134
So that all values are returned in one result, with the following API call:
/api/table.json?content=values&output=json&columns=datetime,value_,coverage&id=14129,14130,14134
The reason for doing this is that pulling large amounts of related data out of PRTG becomes quite a hassle - for example, if I want historical temperature, humidity, and dew point data from a UPS, I need to run three API calls and then concatenate those results in my reporting software.
Perhaps this could be a feature request?
Cameron
Mar, 2017 - Permalink
Hey Cameron,
Unfortunately this is not possible. Please do this sensor by sensor as it is not possible to add several comma separated object-IDs to an API-call.
We really appreciate your feature request, but as we are currently working on several new features and improvements of PRTG it is unlikely that this will come in the near future, I am afraid.
Best regards,
Sven
Mar, 2017 - Permalink
Dear crmunro,
Thank you very much for your KB-posting.
Please clarify if you want to get the last value of the primary channel for all sensors of a particular node (device, group, probe) or of a list of given sensor IDs.
You can get the last value of the primary channel if you list all sensors of a particular node. However to get the data of a pre-defined list, or the data of all channels, you can do it only sensor by sensor.
Best regards,
Sven
Mar, 2017 - Permalink