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

Extracting historical data [API]

Votes:

0

Currently, I was able to extract the current value by doing something like: https://website/api/getsensordetails.json?id=2143&username=something&passhash=something

Though this will only show it's last value. Is there any way to get the daily values, like for the previous month, or week?

api custom-sensor sensor

Created on Jan 21, 2019 1:24:07 PM



7 Replies

Votes:

1

PRTG API's Historic Data function is your friend in this case :)


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Jan 21, 2019 8:45:29 PM by  Stephan Linke [Paessler Support]



Votes:

0

Thanks Stephan, found this a few minutes ago. Is there an option to get the historic data like (7days ago or 1 month ago) instead of putting in start and end date?

Created on Jan 21, 2019 9:20:17 PM



Votes:

1

Instead of the start and end date, you could use:

Get-SensorHistory -EndDate (Get-Date).AddDays(-31) 

...to get the last month :)


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Jan 21, 2019 9:55:32 PM by  Stephan Linke [Paessler Support]



Votes:

0

Thanks for the reply Stephan. How should that go in an API call like this?

/api/historicdata.json?id=objectid&avg=0&sdate=2018-01-20-00-00-00&edate=2018-01-21-00-00-00&usecaption=1

Created on Jan 22, 2019 4:41:39 PM



Votes:

0

That would be the following:

$start = [datetime]::ParseExact("2018-01-20-00-00-00", "yyyy-MM-dd-HH-mm-ss", $null)
$end   = [datetime]::ParseExact("2018-01-21-00-00-00", "yyyy-MM-dd-HH-mm-ss", $null)  

Get-SensorHistory -StartDate $start -EndDate $end

PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Jan 24, 2019 8:06:27 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Instead of the start and end date, you could use:

Get-SensorHistory -EndDate (Get-Date).AddDays(-31) ...to get the last month :)

Exampple above for prev month? how about for previous week for (monday-sunday?)

Created on Dec 12, 2019 5:00:29 AM



Votes:

0

That kind of date calculation isn't easy with PowerShell. Check out the following to obtain the corresponding datetime objects for previous weekdays.

Created on Dec 13, 2019 8:07:25 AM by  Stephan Linke [Paessler Support]




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.