Hi, I am trying to figure out a way to get the following metrics out of PRTG and into our reporting system. For each Device we need the total downtime in a specified fixed period, we will be basing this off the ping sensor for the device. e.g. between 01/10/22-31/10/22 Device X was down for 3min 35 seconds.

I have tried to use the UI for reporting but to be honest, its not easily customisable at all considering from the templates we need about 2% of the actual data and we need in an external company wide reporting system not just PRTG itself.

What options are there to obtain this data in an automated way from PRTG? The REST API would be ideal as it will fit into our existing solutions seamlessly however I cant see any details in the swagger interface for historical data only point in time data.


Article Comments

Hello Alex,

Thanks for contacting us.

My recommendation is to use the PRTG APIv2

https://www.paessler.com/support/prtg/api/v2/overview#toc_18

First you will need to connect to your server

url = 'http://127.0.0.1:8080/api/v2' $token = (Invoke-RestMethod -Method 'POST' -Body '{"username": "<Enter Username>", "password": "Enter Password"}' ($url + '/session')).token $headers = @{'Authorization' = 'Bearer ' + $token}

Invoke-RestMethod -Headers $headers -Uri ($url + '/sensors?filter=' + [System.Web.HttpUtility]::UrlEncode('downtimetotal > 0'))

Please keep in mind that you can update the query accordingly or as needed and based on your needs. This is just a base.

Hope this helps.

Regards,

Miguel Aikens


Nov, 2022 - Permalink

Thanks Miguel, I have managed to get that working, however I am having a hard time interpreting the results. This looks like its bringing back all sensor data as far back as data is kept (1 year). So when you look at downtime_total, its actually a much larger number than just what may have occurred in the past month.

Looking at the v2 documentation http://server/api/v2/overview I cannot figure out a way to use a filter to bring back data between a period (01/xx/2022) (endday/xx/2022), is there a way to do this? Can you confirm the downtime_total parameter is in seconds? If its in seconds one of our servers that had 0 known downtime in the past month is listed as being down for 4.5 hours which definitely doesn't add up at all. Can you give me a bit more insight as to what the data actually refers to?

Thanks, Alex


Nov, 2022 - Permalink

Hi Alex,

Glad you were able to make the get it working.

I did try on my side and couldn't find a way to actually filter it based on certain period or dates unfortunately. Here's more information about what you can do with the APIv2. https://www.paessler.com/support/prtg/api/v2/oas#/Probes/GetProbeOverview

If you would like to provide feedback in regards to the new API you can go it as well in the link above.

Regards,

Miguel Aikens


Nov, 2022 - Permalink