What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

API Historicdata getting total data used

Votes:

0

Your Vote:

Up

Down

Hello

I am trying to parse the total data used in a specific month (for billing purposes). From what i've read, the historicdata should be able to offer me that.

My request is: http://monitor:8080/api/historicdata.json?username=user&password=pass&id=27743&avg=86400&sdate=2016-01-01-00-00-00&edate=2016-01-21-00-00-00

Which provides daily results in the format:

  array(6) {
    ["datetime"]=>
    string(9) "24-2-2016"
    ["datetime_raw"]=>
    float(42424.958333333)
    ["value"]=>
    string(3) "0 %"
    ["value_raw"]=>
    float(0)
    ["coverage"]=>
    string(5) "100 %"
    ["coverage_raw"]=>
    int(9999)
}

How can i get the total (in TB/GB/Bytes) for input, output in the specified period?

From what i've seen, the value is always 0% and value_raw=0 although the graphical interface shows a lot of traffic.

Thank you

api historicdata prtg

Created on Feb 25, 2016 12:52:12 AM by  belcloud (50) 2 1

Last change on Feb 29, 2016 1:50:54 PM by  Erhard Mikulik [Paessler Support]



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

I have tried the Historic Data Reports, which is missing the submit button - http://prntscr.com/a89g4c , but i do need an API call, as i need to parse the information.

Choosing no interval/display data seems to be a big strain on the resources on prtg and on my application to parse it, as far as i understand from the documentation.

Ok, i've found the problem. PRTG's API provides invalid json (multiple keys with same name). I've switched to XML and it seems ok now.

Created on Feb 26, 2016 5:41:24 PM by  belcloud (50) 2 1

Last change on Feb 29, 2016 2:07:36 PM by  Erhard Mikulik [Paessler Support]



4 Replies

Votes:

0

Your Vote:

Up

Down

Have you tried using tab "Historic Data Reports" feature instead the API call? It allows you to set the period and choose "No interval/display raw data".

Kind regards.

Created on Feb 26, 2016 1:02:00 PM by  Erhard Mikulik [Paessler Support]



Accepted Answer

Votes:

0

Your Vote:

Up

Down

I have tried the Historic Data Reports, which is missing the submit button - http://prntscr.com/a89g4c , but i do need an API call, as i need to parse the information.

Choosing no interval/display data seems to be a big strain on the resources on prtg and on my application to parse it, as far as i understand from the documentation.

Ok, i've found the problem. PRTG's API provides invalid json (multiple keys with same name). I've switched to XML and it seems ok now.

Created on Feb 26, 2016 5:41:24 PM by  belcloud (50) 2 1

Last change on Feb 29, 2016 2:07:36 PM by  Erhard Mikulik [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Dear belcloud

For testing, please try CSV instead: /api/historicdata.csv?...

In any case, the historic data API call only provides the values for each interval. If you want to get the sum, your parser has to compute it. Yes, it does put a lot of strain on PRTG. There is an alternative. If you manually start to get a historic data HTML using the webinterface, you see the URL, beginning with /historicdata_html.htm

If you change the ?id= parameter, &sdate= and &edate= parameters, you can get this report for other sensors and other time frames. The HTML produced by this call also has a table with a "Total" row. It might be easier to generate this historicdata_html.htm output and parse the content of the "Total" row.

Created on Feb 29, 2016 1:24:50 PM by  Arne Seifert [Paessler Support]



Votes:

0

Your Vote:

Up

Down

One small addition when using JSON as export format: Add &usecaption=true to the API call.

Created on Feb 29, 2016 1:52:44 PM by  Erhard Mikulik [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.