Custom Webhook for ServiceNow

Sysdig can be integrated with ServiceNow by using a custom webhook.

Configure ServiceNow

Prerequisites

Create Scripted Rest API Details in ServiceNow GUI

  1. Login to ServiceNow (developer entry) and create a Scripted REST API:

  2. Click New and submit the form with the following:

    Name: Specify the Sysdig alert associated with the notification.

    API ID: Specify the API ID.

  3. Return to the Scripted REST APIs and open the resource just created.

    Scroll down to the related list area, select Resources, and click New. This will create a new Scripted REST API resource.

  4. Fill in the Name field. In this example, we chose “Demo”.

  5. Scroll down to Security and clear the checkbox that requires authentication.

  6. Change the HTTP method from GET to POST.

The resource is created.

Add Code to the New Scripted API

Now give the resource the code to execute.

The default objects to work with in a Scripted REST API Resource are response and request.

For more details on request and response see Scripted Rest APIs.

The created resource will already have some example code:

(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {

    // implement resource here

})(request, response);
  1. Change this default code to:

    (function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
    
     gs.info(request.body.dataString);
    
    })(request, response);
    
  2. Note the following resource path to this newly created resource is now visible: /api/snc/sysdigalert.

    The url to this resource would be https://yourInstance.service-now.com/resource-path or https://yourInstance.service-now.com/api/snc/sysdigalert

  3. Click Submit/Update on this resource.

Configure Sysdig Webhook

Now that the custom API endpoint in ServiceNow is created, you can configure Sysdig alerts to use a custom webhook to trigger the ServiceNow integration.

  1. In Sysdig Monitor, complete steps 1-3 in Set Up a Notification Channel and choose Custom Webhook.

  2. Fill out the form.

URL: Your instance name URL.

Name: Choose a meaningful name, for example, “ServiceNow”.

Notify when Resolved: Use this toggle to choose whether you want to receive a notification when the alert condition is no longer triggered.

Notify when Acknowledged: Use this toggle to choose whether you want to receive a notification when the alert is manually acknowledged.

Test Notification: Use this toggle and/or set up a test alert as described in the following section.

Test Integration

To test if this ServiceNow integration is working correctly, you can set up a test alert to trigger.

For example, you could create an alert for CPU usage:


In ServiceNow, navigate to System Log > All to see a sample triggered webhook.