Harness and Splunk On-Call (VictorOps)

Hey All!

I’ve had a few conversations around integrations with Harness and other tools, what is and is not supported, and even when specific integrations will be coming. One of the great things about a Software-as-a-Service like Harness is that you get rapid integration support with use-case-directed development.

We will need to supplement a stop-gap for some of these integrations in the meantime. The technology integration that this post covers will be Splunk On-Call (formerly known as VictorOps).

There is a way to do Email notifications in Splunk On-Call as an easy integration.

For those who want something more robust, here are the steps to have Harness create and even resolve an incident.


Splunk On-Call API Information

The first step is to get the API ID and API Key from Splunk On-Call:

Integrations
image

API

Activate API

Copy API ID and API Key in Harness Secrets Manager

victorops-api-id
image

victorops-api-token
image

Template Library

Here are the Create and Resolve templates that will be used for the integration

With the API enabled and the API secrets in the Harness Secrets Manager, the next step is to add the templates to the Template Library. Since the nature of Splunk On-Call is to be used for major incidents, we will want to use these templates in the case of an actual issue. Therefore, we will use the Create template in the case of a workflow failure and the Resolve template if the rollback is successful.

The first step is to add the Create template to the Template Library with the appropriate variables included:

  1. Setup > Template Library > + Add Template > Shell Script
    a. Name: “victorops_create”
    b. Script: Create Template
    c. Script Variables: SUMMARY, DETAILS, USERNAME, SLUG_USER, and POLICY_NAME
    d. Script Output: NUM

After that is done, you’ll need to add the Resolve template to the Template Library with the appropriate variables included:

  1. Setup > Template Library > + Add Template > Shell Script
    a. Name: “victorops_resolve”
    b. Script: Resolve Template
    c. Script Variables: USERNAME and INCIDENT
    NOTE: Set INCIDENT value to ${context.CREATE.NUM}

One other thing to note about these templates. These are intended to be the basic set of requirements to create an incident. Your organization might require more information than is there. You will need to change the template accordingly. Also, in the Create template, there is a process to get the Policy Slug ID based on the Policy Name. If the policy name needs to be changed, it is in the Variables section of Create Template and can be filled in as needed.

Workflow Integration

In the desired workflow, preferably one that deploys to production only, you’ll need to customize the Rollback Steps.

Workflow > Deploy Phase > Rollback Steps > + Add Step > Template Library > Link the victorops_create template

image

image

With the Create Template linked to the Rollback Steps, you’ll need to select “Publish output in the context”, set the variable name to CREATE, and set the Scope to Phase

After hitting Submit, make sure to move the Create Template to the top of the Rollback Steps and then follow the same process to add the Resolve Template to the bottom of the Rollback Steps.

Workflow > Deploy Phase > Rollback Steps > + Add Step > Template Library > Link the victorops_resolve template

There are no other steps required once the Resolve Template is linked

Workflow Execution

Splunk On-Call Dashboard

Harness Failed Execution

Incident Created

Successful Rollback

Incident Resolved

That is all it takes to add the Splunk On-Call integration into your deployment process!

I will update this post as some functionality is improved or if new issues arise.

Don’t forget to Comment/Like/Share!

1 Like