PagerDuty Integration with WhatsUp Gold

This integration works by logging WhatsUp Gold alerts to a file containing JSON formatted for PagerDuty's Events API. A VBScript then iterates through every file in the queue directory where alerts are written to and sends the JSON to PagerDuty, deleting the alert file after it has been accepted by the server.

 

In PagerDuty

 

1. Go to the Configuration menu and select Services.

 

2. On the Services Page:

  • If you are creating a new service for your integration, click Add New Service

RS-Add-New-Service

 

RS-Add-Integration-Existing-Service

 

3. Select your app from the Integration Type menu and enter an Integration Name.

  • If you are creating a new service for your integration, in General Settings, enter a Name for your new service. Then, in Incident Settings, specify the Escalation Policy, Notification Urgency, and Incident Behavior for your new service.

 

4. Click the Add Service or Add Integration button to save your new integration. You will be redirected to the Integrations page for your service.

RS-Integration-Settings

 

5. Copy the Integration Key for your new integration.

RS_Updates__API_Services-1024x146

 

On Your WhatsUp Gold Server

 

1. Create the following directories on your WhatsUp Gold server's C: drive:

* C:\PagerDuty

* C:\PagerDuty\Queue

 

2.Download the attached VBScript, saving it to C:\PagerDuty on your WhatsUp Gold server.

 

3. Log in to the WhatsUp Gold web console as admin, then go to Settings-> Actions & Alerts -> Actions and Policies

 

4. Create a new Log to Text File action in the Action Library.

PD_WhatsUp_Gold_Log_To_Text

 

 

5. Give the new action a Name such as “Log Alert to PagerDuty Queue”, set the Log file path to C:\PagerDuty\Queue\%Device.HostName_Down.txt, change the Log file write mode to Overwrite, then copy and paste the following into the Log Message field:

 

{

"service_key": "YOUR-INTEGRATION-KEY-HERE",

"incident_key": "%Device.Address Monitors Down",

"event_type": "trigger",

"description": "%Device.ActiveMonitorDownNames %Device.State on %Device.HostName",

"details": {

"Monitors that are down": "%Device.ActiveMonitorDownNames",

"Monitors that are up": "%Device.ActiveMonitorUpNames",

"Host Name": "%Device.HostName",

"IP Address": "%Device.Address"

}

}

 

Be sure to replace YOUR-INTEGRATION-KEY-HERE with the PagerDuty integration key you created earlier.

 

WUG_Trigger_Action

 

 

6. Create another new Log To Text File action in the Action Library. Give this new action a Name such as “Log Recovery to PagerDuty Queue”, set the Log file path to

C:\PagerDuty\Queue\%Device.HostName_Up.txt, change the Log file write mode to Overwrite, then copy and paste the following into the Log Message field:

 

{

"service_key": "YOUR-INTEGRATION-KEY-HERE",

"incident_key": "%Device.Address Monitors Down",

"event_type": "resolve",

"description": "%Device.ActiveMonitorDownNames %Device.State on %Device.HostName"

}

 

Be sure to replace YOUR-INTEGRATION-KEY-HERE with the PagerDuty integration key you created earlier.

 

WUG_Resolve_Action

 

7. Create a new Program Action and give the new action a Name such as “Execute PagerDuty VBScript”, set the Program file name to C:\Windows\System32\cscript.exe, the Working path to C:\PagerDuty, and the Program arguments to //B "C:\PagerDuty\PagerDuty.vbs".

 

WUG_Add_Action_Program

 

8. Create a new Action Policy and give it a Name such as “PagerDuty” (or edit an existing policy already in use by the devices you want to start triggering alerts for in PagerDuty) then add the PagerDuty actions you created for both Up and Down states. The Log Alert action should be performed for the Down state, and the Log Recovery action should be performed for the Up state, while the Program Action (VBScript execution) should be performed for both states, but after the Log Alert or Log Recovery action has been performed.

 

WUG_Action_Policy

 

9. Configure your devices to use this Action Policy by going to My Network, selecting a device, and clicking Properties. Go to the Actions tab and select Edit next to Apply the following Action Policy, then choose the Action Policy you created or updated in the previous step.

 

WhatsUp_Gold_PD_Action

 

 

(continued in next post)

 

 


  • Theodore Herrera (Progress Software)

    This is not Officially Supported by WhatsUp Gold

    Selected as Best
  • On your WhatsUp Gold Server

     

    10. Remote Desktop into your WhatsUp Gold Server and Open Windows Task Scheduler and click Create Task… on the Actions sidebar. Give the task a Name, like PagerDuty, and select Run whether user is logged in or not.

    Windows-Task-Scheduler-Create-Task

     

     

    11. Switch to the Triggers tab and click New…, then click the drop down list for Begin the task and select At startup. Now check the box labeled Repeat task every: and type in 1 minute (this option isn’t in the list, you must manually type it in), then change the duration to Indefinitely and click OK. Repeat these steps, only selecting At task creation/modification the second time around.

    Windows-Scheduled-Task-Triggers

     

     

    12. Select the Actions tab and click New…. Set the Program/script to C:\Windows\System32\cscript.exe and Add arguments to //B "C:\PagerDuty\PagerDuty.vbs", then click OK.

    Windows-Scheduled-Task-Actions

     

    13. Click OK.

    SAM-ST-Created

     

    14. WhatsUp Gold will now be able to trigger and resolve incidents in PagerDuty, and the scheduled task will re-try sending events in case they aren’t successfully sent in the first attempt (i.e. due to connectivity issues).

     

    Customizing Your Alerts

    You can customize the alert data sent to PagerDuty by changing the Log Message in your Log To Text File action. The file should be logged to C:\PagerDuty\Queue

    with a .txt file extension, and the content should be JSON that is formatted for PagerDuty's Events API.

     

    Special Characters: If you have an alert which uses characters that will affect the JSON output, such as a quotation mark, then you will need to escape those characters with a backslash, or modify the VBScript to handle them. For example, if you add quotation marks to an alert, add a backslash (\ ) before them so they look like \" in your Log To Text File action. Other special characters can be escaped if needed by modifying the VBScript and using the Replace method, which is what we use in the script to escape backslashes, as backslashes have a special purpose in JSON as the escape character, but are also used in alerts containing Windows paths.

     

    Lastly, you’ll want to make sure there is a Program Action configured that executes "C:\PagerDuty\PagerDuty.vbs" using the CScript.exe interpreter. This allows WhatsUp Gold to send the alert to PagerDuty immediately, rather than having to wait for the scheduled task to run before it gets sent to PagerDuty.

     

    Please refer to https://www.pagerduty.com/docs/guides/whatsup-gold-integration-guide/ for additional information.

     

  • Theodore Herrera (Progress Software)

    This is not Officially Supported by WhatsUp Gold

    Selected as Best