PRTG Manual: Custom Notifications

In addition to the various standard methods for notifications, you can define your own notifications that can trigger desired actions. The following documentation describes these custom notifications. You can also combine different notification methods in one notification.

i_square_cyanFor more general information about notifications based on email, messaging, and others, see section Notifications.

Execute HTTP Action

This notification method executes a GET request or sends any POST, PUT, or PATCH data to a custom URL. You can execute specific actions on a web server or control any web service that accepts commands via one-time HTTP requests. Whenever a notification of this kind is triggered, the HTTP action is sent.

With this method, you can also call any application programming interface (API) function of the PRTG web interface. For example, you can automatically pause a sensor or acknowledge an alarm.

i_round_redAuthentication with API key or user name and passhash (or user name and password) must always be included in each PRTG API request. See section HTTP API for more information.

i_speechExamples

To automatically pause the sensor that triggers the notification, enter the following HTTP action:

http://yourserver/api/pause.htm?id=%sensorid&action=0&username=myuser&password=mypassword

To use the notification to automatically acknowledge the alarm that triggered it, enter this HTTP action:

http://yourserver/api/acknowledgealarm.htm?id=%sensorid&ackmsg=Auto-Acknowledged&username=myuser&password=mypassword

i_square_cyanFor more information about authentication within the URL and for other possible actions you can configure, see sections HTTP API and Object Manipulation.

Execute Program

With this notification method, you can execute a script or a program as an external process. It can be a Windows executable file or a .bat, .cmd, or PowerShell file. You can use .exe, .com, .bat, .cmd, .vbs, or .ps1 files.

i_round_redYou must create the notification as a file and place it in a specific subfolder on the PRTG core server system (in a cluster, copy the files to every cluster node).

Place executables (.exe, .com), batch files (.cmd, .bat), VBS scripts (.vbs), or PowerShell scripts (.ps1) into the folder:

\Notifications\EXE

As soon as a file is placed into the subfolder, you can create or edit your own custom execute program notification and select the new file from the list of files. You can also enter start parameters and use PRTG placeholders for this.

Notes

  • PRTG executes the file on the local PRTG core server system using the account configured for the PRTG core server service (the default is system).
  • If your custom notification's code relies on other files (for example, .dll, .NET framework, or Windows PowerShell), you must copy/install these files on the PRTG core server system manually.
  • Make sure the return code of the executable is 0 (zero). Otherwise PRTG assumes something went wrong with the notification and tries to send it up to 3 times.
  • If you run PRTG in a cluster, copy the respective files to every cluster node to make sure the notification also works when the primary master node is not reachable.
  • EXE notifications fail if they attempt to open any graphical user interface windows using the Win32 APIs (this is not allowed for processes that are started by a system service).
  • To remotely run PowerShell scripts, make sure that you set the according Execution Policy. For more information, see the Knowledge Base: PowerShell 32 bit and 64 bit and Execution Policy.

Placeholders

i_square_cyanFor more information about the placeholders you can use, see section Placeholders for Notifications.

PRTG Sensor Hub

You can find scripts for custom sensors that were written by dedicated PRTG customers in the PRTG Sensor Hub.

More

i_square_blueKNOWLEDGE BASE

Custom notifications

PowerShell 32 bit and 64 bit and Execution Policy