Hello Steve,
Since the historicdata API requires a sensor ID, it can't be filtered at that query level, in that case you will require two distinct API calls, a first one to get you the oids of all ping sensors, it would look like:
http://YOURPRTGSERVER/api/table.xml?content=sensors&output=xml&columns=objid,sensor&filter_tags=@tag(pingsensor)"
By default all Ping Sensors have the pingsensor tag, the output will look like:
<?xml version="1.0" encoding="UTF-8"?>
<sensors totalcount="11" listend="1">
<prtg-version>15.2.18.2816</prtg-version>
<item>
<objid>2010</objid>
<sensor>Ping</sensor>
</item>
<item>
<objid>2019</objid>
<sensor>Ping</sensor>
</item>
</sensors>
You can then use any iteration method (for, while, ...) to perform the next API call using the previously obtained objid (in this example, 2019) as parameter for the new API call:
http://YOURPRTGSERVER/api/historicdata_totals.xml?id=2019&sdate=2015-06-10-00-00-00&edate=2015-06-23-00-00-00&avg=3600&pctavg=300&pctshow=false&pct=95&pctmode=true
This should provide you with the solution to what you want to achieve using only two API Calls. For further questions.
Best regards.
Add comment