November 14, 2016

Pulling historic data using API PRTG




The PRTG Application Programming Interface (API) enables you to access monitoring data and manipulate objects using HTTP requests.


In my workplace i've got request from the client to pull a couple (hundreds) traffic sensor in a last 7 days into data table (csv form). So i do several test and the results is the link below.


/api/historicdata.csv?id=(sensorid)&avg=300&sdate=2016-11-07-00-00-00&edate=2016-11-10-23-59-59 

Based on the link above when you pulling it via browser http://yourprtglink//api/historicdata.csv?id=(sensorid)&avg=300&sdate=2016-11-07-00-00-00&edate=2016-11-10-23-59-59 

It would generate csv file named historicdata.csv saved to your specified location on your drive.

historicdata.csv = filename
id = selected sensor id
avg = time interval in seconds (300s for 5 minutes interval)
sdate = starting date 
edate = end date 


Now the problem is how to make it easier to conect it to mysql database without uploading the csv.
Is there any mysql plugin to do the job? maybe i'll ask the ADB about it.

No comments:

Post a Comment

Follow and I will Foll Back