Hi,

Is it possible to collect state change (alert) information for our sensors WITH historical data (past changes) and in bulk (all sensors in one call or at least in large groups) via the PRTG API?

So far I have been sifting through the documentation and I haven't found a way to achieve that, but I am hoping that I may have missed something or the necessary option exists but is not documented.

Thanks, Alex


Article Comments

Dear Alex

Using the API, only one sensor per call can be queried. To get the data of multiple sensors, please write a script which in the first steps reads the object ID of all sensors from a particular device tree branch, and then iterates over those IDs.

An example call is

/api/table.xml?id=40&content=sensors&columns=objid,name&count=*

This call will provide all sensors under the local probe device (which has the id=40.)

Alert information is not part of the historic data and cannot be extracted in the same way. You can use an API call and filter for up and down messages:

api/table.csv?id=2123&content=messages&filter_status=620&filter_status=608&filter_status=607&count=*&columns=objid,datetime,parent,type,name,status,message

This example is for a sensor with the id=2123.


Jul, 2017 - Permalink