PRTG Manual: Custom Notifications
In addition to the various standard methods for notifications, you can also define your own notifications that can trigger desired actions. The following documentation describes these custom notifications. Different notification methods can also be combined in one notification.
For more general information about notifications based on email, messaging, and others, see section Notifications.
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 set PRTG to automatically pause a sensor or acknowledge an alarm.
To automatically pause the sensor that triggers the notification, enter the following HTTP action:
To use the notification to automatically acknowledge the alarm that triggered it, enter this HTTP action:
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.
You must create the notification as a file and place it in a specific folder on the PRTG core server system (in a cluster, copy the files to every node).
Place executables (.exe, .com), batch files (.cmd, .bat), VBS scripts (.vbs), or PowerShell scripts (.ps1) into the folder:
As soon as a file is placed into the folder, 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.
- PRTG executes the file on the local PRTG core server system using the account configured for the PRTG core server service (system is default).
- If your custom notifications code relies on other files (for example, .dll, .NET framework, or Windows PowerShell), you must copy/install these files on the PRTG core server machine 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.
- When running PRTG in a cluster, copy the respective files to every single node to make sure the notification also works when the primary master 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.
For more information about the placeholders you can use, see the Knowledge Base: What placeholders can I use with PRTG?
You can find scripts for custom sensors that were written by dedicated PRTG customers in the PRTG Script World.
For more information about custom notifications, see the Knowledge Base, tag-set "custom-notification".