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

PRTG HTTP api - get log of alerts

Votes:

0

Hello,

I want to build an application that I can use in the morning to scan all the errors that have occurred during that night. Is there an API call that I can use which will give me the data shown in https://www.paessler.com/manuals/prtg/logs?

api logs rest

Created on Mar 20, 2019 10:14:46 AM



1 Reply

Votes:

0

You can do this fairly easily with PrtgAPI, using either C# or PowerShell

The following shows the basic usage using PowerShell

C:\> Get-ObjectLog -Status Down

DateTime               Id     Name                       Device             Status         Message
--------               --     ----                       ------             ------         -------
20/03/2019 7:50:16 PM  2286   CPU Load                   exch-1             Down           92 % (Total) is above the...
20/03/2019 7:50:16 PM  2286   CPU Load                   exch-1             Down           92 % (Total) is above the...
20/03/2019 7:49:51 PM  2286   CPU Load                   exch-1             Down           93 % (Total) is above the...
20/03/2019 7:47:00 PM  2286   CPU Load                   exch-1             Down           93 % (Total) is above the...
20/03/2019 7:46:50 PM  2286   CPU Load                   exch-1             Down           97 % (Total) is above the...
20/03/2019 7:46:16 PM  2286   CPU Load                   exch-1             Down           93 % (Total) is above the...
20/03/2019 6:13:54 PM  2036   Ping                       8.8.8.8            Down           Destination network unrea...
20/03/2019 6:13:33 PM  2036   Ping                       8.8.8.8            Down           Destination network unrea...
20/03/2019 6:13:24 PM  2036   Ping                       8.8.8.8            Down           Destination network unrea...
20/03/2019 5:50:16 PM  2286   CPU Load                   exch-1             Down           93 % (Total) is above the...
20/03/2019 5:50:16 PM  2286   CPU Load                   exch-1             Down           93 % (Total) is above the...
20/03/2019 5:49:44 PM  2286   CPU Load                   exch-1             Down           92 % (Total) is above the...
20/03/2019 5:23:00 PM  2286   CPU Load                   exch-1             Down           100 % (Total) is above th...
20/03/2019 5:22:44 PM  2286   CPU Load                   exch-1             Down           94 % (Total) is above the...
20/03/2019 5:22:16 PM  2286   CPU Load                   exch-1             Down           100 % (Total) is above th...
20/03/2019 5:11:00 PM  2286   CPU Load                   exch-1             Down           92 % (Total) is above the...
...

You can specify a start and end range for your query, then group by ID to get a list of unique events

# Get all alerts that occurred in the last 24 hours
C:\> Get-ObjectLog -status Down -EndDate (get-date).adddays(-1) | group Id

Count Name                      Group
----- ----                      -----
   22 2286                      {20/03/2019 7:50:16 PM: CPU Load, 20/03/2019 7:50:16 PM: CPU Load, 20/03/2019 7:49:5...
   15 2036                      {20/03/2019 6:13:54 PM: Ping, 20/03/2019 6:13:33 PM: Ping, 20/03/2019 6:13:24 PM: Pi...
    1 2928                      {20/03/2019 11:09:31 AM: Service: PRTG Probe Service}
    3 2203                      {20/03/2019 3:27:00 AM: Memory Device 1 VDIMM, 20/03/2019 3:26:37 AM: Memory Device ...
    3 2204                      {20/03/2019 3:27:00 AM: Memory Device 64 P1-DIMMA1 Temp, 20/03/2019 3:26:35 AM: Memo...
    3 2205                      {20/03/2019 3:27:00 AM: Memory Device 65 P1-DIMMA2 Temp, 20/03/2019 3:26:33 AM: Memo...
    3 2206                      {20/03/2019 3:27:00 AM: Memory Device 68 P1-DIMMB1 Temp, 20/03/2019 3:26:31 AM: Memo...
    3 2207                      {20/03/2019 3:27:00 AM: Memory Device 69 P1-DIMMB2 Temp, 20/03/2019 3:26:30 AM: Memo...
...

Based on your requirements, this could simply be a one liner (with the end date simply being 5pm yesterday, etc) or you could wrap this up in a slightly more advanced application, potentially sending you an automated report, etc

Regards

lordmilko

Created on Mar 20, 2019 12:00:42 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.