How do you filter by the datetime column when querying the history endpoint? I am trying to get ONLY historical messages for that are GREATER THAN the time in which the report is run. Can you please provide an example of filtering by greater than, less than and equal to a history message datetime?
table.json?content=history&id=1234&filter_datetime=2020-01-01-00-00-00&columns=user,message,datetime
Article Comments
Hi John,
Based on your request it sounds like you are trying to retrieve the "modification history" events of an object (which is what content=history returns, as opposed to the sensor channel history data).
To filter for all modification history events greater than a specified date (e.g 2/2/17) you would do
http://prtg.example.com/api/table.xml?content=history&columns=datetime,user,message&count=*&id=40&username=prtgadmin&passhash=12345678&filter_datetime=@above(42767.5416666667)
Where 42767.5416666667 is the OA DateTime representation of 2/2/17. Depending on the programming language you're using, you may or may not have difficulty creating such a value in the first place.
Alternatively, as Stephan says, you can use PrtgAPI. In this instance, you would want to use the Get-ModificationHistory cmdlet. While this cmdlet does not specify filtering by date server side, you can still filter by date client side
# Get all modification events on the object with ID 1001 since this time yesterday Get-ModificationHistory -Id 1001 | where DateTime -gt (get-date).adddays(-1)
Regards,
lordmilko
Nov, 2020 - Permalink
It's easier to use PRTGapi here :)
Nov, 2020 - Permalink