Is it possible to integrate ScriptRunner into PRTG? What steps do I need to take?
How to integrate ScriptRunner into PRTG?
Votes:
0
1 Reply
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.
- 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
- Under Setup | Account Settings | Notification Templates, select the Edit button next to the Execute Program notification template that you created.
- Select Send test notification.
- In the Notification Test Results dialog, check that the notification has been triggered and queued.
- Click OK.
- Check if the script was run.
Set up a Notification Trigger
- Go to the Notification Triggers tab of the sensor that monitors the service, for example an SNMP Windows Service sensor.
- Add a new trigger, for example a State Trigger.
- Configure the trigger as follows, for example.
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]
Add comment