Hi, I'm developing an application that periodically performs api calls to retrieve historic data from my prtg sensors. I'm using the 'api/historicdata.json' call, and I've noticed that performing a call with 'sdate' and 'edate' parameters too close between each other (ex. 'sdate=2022-08-10-15-09-00&edate=2022-08-10-15-12-00') gives me as an answer no data and the message 'Not enough monitoring data'. By performing again the same call but with a wider temporal range I discover that there is indeed some data generated within the previous temporal range. Is there a minimum number of values retrievable for the historic data call? Can it be changed in the settings? I've set the 'avg' parameter to 0 for my calls and I'm currently using this version of prtg: PRTG Network Monitor 22.2.76.1705 x64. Thank you for your time
Historic data api call answering 'Not enough monitoring data'
Votes:
0
Best Answer
Votes:
1
Hello Dear customer,
I would recommend you
- Indeed, it is not possible to retrieve values for too short intervals
- If you want to use the same value for sdate and edate you are free to do that. We do not plan any changes to the classic API (we are currently focusing our development efforts on the upcoming new API which will also have a way to retrieve historic data in due course).
You should just be aware that if you include a hard-coded value here then (a) the dataset you get back will grow continuously and, (b) the performance impact that each request has on the core will grow.
3 Replies
Votes:
1
Hello Dear customer.
Can you please share the API script you are using? Also, ensure that you are trying to retrieve data from date ranges containing information.
Additionally, you mentioned that you are running PRTG version 22.2.76.1705 x64 so it is now an old version, I highly recommend you upgrade the version to the latest version as you can see on this article: https://www.paessler.com/prtg/history/stable
You can use the Auto-Update option (http://www.paessler.com/manuals/prtg/auto_update.htm).
Alternatively, you can update your PRTG manually; on the following link you can find the installer for the latest version: https://downloads.paessler.com/prtg/prtg.zip
You can simply run the exe file directly over the version currently running. The configuration and database will not be affected by installing the newer version over the old and the configuration is automatically backed up before this process. Please note that the hosting machine may be restarted during the update process. Please update your PRTG installation to the latest software version, as we have introduced numerous improvements and bug fixes since your current version.
You can use the Auto-Update option (http://www.paessler.com/manuals/prtg/auto_update.htm).
Votes:
0
Hi, thanks for the reply.
I've updated my prtg to the latest version (PRTG Network Monitor 22.3.78.1873 x64) but the problem still persists.
Here below there's the code for the type of call I'm trying to make (I'm using 3.8.0 Python and 2.25.1 requests versions). I'm trying to retrieve data from a HTTP sensor setted with an interval of 60 seconds within a time range of 3 minutes (as shown below).
I'm sure there is some data in that range (if I extend it by just one minute I can see it clearly), but when I make the call I still get as a response Not enough monitoring data.
I've tried also to make the same call with the historic data query builder at http://127.0.0.1/historicdata.htm but with no luck.
On the other hand I also noticed that by making the call with the exact same time for the edate and sdate parameters I always get as a response all the latest data from that time (I'm planning to use this method for retrieving data, but I don't know if it is an unwanted feature that will be removed in the future).
import requests
url = 'http://127.0.0.1/api/historicdata.json'
sdate = '2022-08-17-09-51-00'
edate = '2022-08-17-09-54-00'
params={
'id' : id,
'sdate' : sdate,
'edate' : edate,
'avg' : 0,
'usecaption' : 1,
'username' : username,
'password' : password
}
response = requests.get(url, params=params, verify=False)
print(response.text)
Votes:
1
Hello Dear customer,
I would recommend you
- Indeed, it is not possible to retrieve values for too short intervals
- If you want to use the same value for sdate and edate you are free to do that. We do not plan any changes to the classic API (we are currently focusing our development efforts on the upcoming new API which will also have a way to retrieve historic data in due course).
You should just be aware that if you include a hard-coded value here then (a) the dataset you get back will grow continuously and, (b) the performance impact that each request has on the core will grow.
Add comment