<%NUMBERING1%>.<%NUMBERING2%>.<%NUMBERING3%> 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.

icon-book-arrowsFor 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 set PRTG to automatically pause a sensor or acknowledge an alarm.

icon-i-round-redAuthentication with username and passhash (or username and password) must always be included in each PRTG API request. See section Authentication for more information.

icon-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

icon-book-arrowsFor 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.

icon-i-round-redYou 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:

\Notifications\EXE

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.

Notes

  • 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.

Placeholders

icon-book-bulbFor more information about the placeholders you can use, see the Knowledge Base: What placeholders can I use with PRTG?

PRTG Script World

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

More

icon-book-bulbFor more information about custom notifications, see the Knowledge Base, tag-set "custom-notification".

 

Application Programming Interface (API) Definition—Topics

Keywords: