What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Historic data or graph API

Votes:

1

This are the URLs given in the doc

/api/historicdata.csv?id=objectid&avg=0&sdate=2009-01-20-00-00-00&edate=2009-01-21-00-00-00

/chart.png?id=objectid&avg=15&sdate=2009-01-20-00-00-00&edate=2009-01-21-00-00-00&width=850&height=270&graphstyling=baseFontSize='12'%20showLegend='1'&graphid=-1

Is there not a way, also, to use any time range like the one which are provided in the web pages, like 1 day, 7 days, today, yesterday, last week, last month, instead of having to calculate a start date from today's date before to configure the URL.

This could be very helpful for some cases. For example to configure a button with personnal html on a map just to have a look with 1 click on the graph of known periods or known cases without to go back to the PRTG session to do again all the choises.

If there are not such hidden functions, I think all the html and js file are already existing in PRTG to provide such a solution to non programmer customers.

This would lead to very simple API URLs:

/api/historicdata.csv?id=objectid&avg=0&daterange=yesterday

or

/chart.png?id=objectid&avg=15&daterange=lastweek&width=850&height=270&graphstyling=baseFontSize='12'%20showLegend='1'&graphid=-1

api daterange historicdata

Created on Dec 5, 2014 11:06:35 AM



4 Replies

Votes:

0

How about this as personal html, it dynamically produces the chart of sensor 2064 for the last three months

<html>

<head>
<script language="JavaScript">
function prtgdate(date)
  {
  //format date to yyyy-mm-dd-00-00-00
  var twoDigitMonth = date.getMonth()+1+"";
  if(twoDigitMonth.length==1) twoDigitMonth = "0" + twoDigitMonth;
  var twoDigitDay = date.getDate()+"";
  if(twoDigitDay.length==1) twoDigitDay = "0" + twoDigitDay;
  return date.getFullYear() + "-" + twoDigitMonth + "-"+ twoDigitDay + "-00-00-00"
  }
</script>
</head>

<body>

<script language="JavaScript">
var start = new Date();
// set startdate three months back
start.setMonth(start.getMonth() -3);
start = prtgdate(start);
// set enddate to today
end = prtgdate(new Date());
// request chart
window.open("https://example.com/chart.png?id=2064&avg=60&sdate="+start+"&edate="+end+"&login=demo&password=demodemo");
</script>

</body>
</html>

Created on Dec 5, 2014 1:57:04 PM

Last change on Aug 10, 2018 9:03:20 AM by  Brandy Greger [Paessler Support]



Votes:

0

One note to the solution above, please consider using an average of at least 300 seconds (better 1 hour) as avg parameter in the call. A minute average in 3 months graph results on 129K values (meaning with 1 pixel per value the graph needs to be over 120000 pixel wide).

Created on Dec 5, 2014 2:07:47 PM by  Torsten Lindner [Paessler Support]



Votes:

0

any answer for this?

Created on Mar 24, 2021 5:16:07 AM



Votes:

0

any upadate on this issue?

Created on Mar 24, 2021 2:49:27 PM




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.