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

How to integrate ScriptRunner into PRTG?

Votes:

0

Is it possible to integrate ScriptRunner into PRTG? What steps do I need to take?

notifications powershell prtg scriptrunner

Created on Feb 12, 2019 8:47:52 AM by  Brandy Greger [Paessler Support]



1 Reply

Accepted Answer

Votes:

0

This article applies as of PRTG Network Monitor 19

Integrating ScriptRunner into PRTG using Notifications

PRTG monitors the availability and performance of your entire IT infrastructure around the clock. In case of failures and faults, PRTG can send alarms to ScriptRunner via notifications and a PowerShell script. ScriptRunner then automates and delegates PowerShell scripts. This allows ScriptRunner to solve many problems reported by PRTG automatically.

Prerequisites

  • ScriptRunner must be installed and configured.
  • No firewall blocks the web service connection on the ASR port inbound/outbound.
  • The permissions to run PowerShell scripts must be set on the PRTG host and target system. See this article for more information on enabling the Execution Policy.
  • The administrative account to run the script on the target system must be a member of the Remote Management Users group.
  • In Active Directory, create the group ASR Monitoring.
    • In the ASR Monitoring group, include the PRTG AD user whose user context is used to run the caller script on the PRTG host.
    • On the ScriptRunner host, create a new operator group in ScriptRunner and assign it to the ASR Monitoring group.
  • Copy and save the caller script CallASRWebSvcConnector.ps1 to the \Notifications\EXE subfolder of the PRTG program directory. The script is in the ProgramData\AppSphere\ScriptMgr\EXPL\Common subdirectory of the ScriptRunner installation.

Important Notes

  • In the script, you must enter the URL and port number of the ASR host.
  • The name of the monitoring sensor in PRTG ('%sensor') must correspond to the name of the monitored service for the example script.
  • The ActionName when calling the caller script must correspond to the action name in ScriptRunner. Make sure to adapt it accordingly on both sides. In this example, it is Repair-Service.
  • ParamNames and ParamValues form pairs that belong together. The parameters in ParamNames must match the parameters in the action script. The ParamValues can then be further processed in the action script.

Set up the Automation in ScriptRunner

  • Copy the action script into the ScriptRunner script directory.
  • In ScriptRunner, configure an action for this script and authorize it for the group ASR Monitoring without the target system (Direct Local Execution).

Set up a Notification in PRTG

  • Under Setup | Account Settings | Notification Templates, add a new Execute Program notification template.

Execute Program
Click to enlarge.

  • Under Template Name, enter a name to identify the template, for example ScriptRunner Call.
  • Under Program File, select Callasrwebsvcconnector.ps1.
  • Under Parameters, enter the following
    -ActionName "Local: Add two values" -ParamNames "valuea","valueb" -ParamValues ´%sensor´, ´%server´, ´%status´
  • For ActionName, enter the name of the action in ScriptRunner, for example Local: Add two values.
  • For ParamNames, enter the parameters of the action script in ScriptRunner. For example, "valuea", "valueb", and mystatus.
  • For ParamValues, enter the parameters to be passed from PRTG, for example ´%sensor´, ´%server´, ´%status´. You can use placeholders here. See What placeholders can I use with PRTG? for more information.
  • Enter the Domain or Computer Name, Username, and Password of the calling user that you previously added to the ASR Monitoring AD group.
  • Under Timeout, enter a timeout in seconds that reflects how long the execution of the script takes.
  • Click Create to create the notification template.

Test the Notification

  1. Under Setup | Account Settings | Notification Templates, select the Edit button next to the Execute Program notification template that you created.
  2. Select Send test notification.
  3. In the Notification Test Results dialog, check that the notification has been triggered and queued.
  4. Click OK.
  5. Check if the script was run.

Set up a Notification Trigger

  1. Go to the Notification Triggers tab of the sensor that monitors the service, for example an SNMP Windows Service sensor.
  2. Add a new trigger, for example a State Trigger.
  3. Configure the trigger as follows, for example.

Add State Trigger
Click to enlarge.

When the notification is triggered, the ScriptRunner script restarts the monitored service and the sensor returns to an Up status.

See Also

Created on Feb 12, 2019 10:58:58 AM by  Brandy Greger [Paessler Support]

Last change on Jan 9, 2023 8:06:45 AM by  Jacqueline Conforti [Paessler Support]




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.