Integrate xMatters with Dynatrace Cloud Automation
Integrating Dynatrace Cloud Automation with xMatters allows SREs and developers to alert the right people, automatically initiate incidents, get more information from a CI/CD application, or send updates via your chosen chat application when an event occurs in Cloud Automation.
To integrate Dynatrace Cloud Automation with xMatters, follow the instructions below.
Prerequisites
xMatters
Dynatrace
xMatters
-
Install the Dynatrace Cloud Automation workflow template.
Dynatrace
-
Create a Cloud Automation project with a shipyard file that has a custom task (for example,
runbook
) used to trigger the xMatters subscription. -
Add the xMatters user name, password, or API key obtained above as a Cloud Automation secret based on one of the following authentication methods:
-
URL authentication
-
Basic authentication
-
API key authentication
-
Set up the xMatters webhook subscription
Use case: Set up a passive webhook subscription that triggers an xMatters workflow. The Cloud Automation sequence will not wait for xMatters to send back a Cloud Automation sequence task finished event.
-
On the Cloud Automation bridge, select your Cloud Automation project.
-
Select Settings and then select Integrations.
-
Select webhook-service from the list and then select Add subscription.
-
Enter the following values:
-
Task: Select the task associated with your shipyard file (in this case,
runbook
). -
Task suffix: The task suffix sets one of the following webhook types:
recommended
Passive webhooks don't require a response from xMatters before continuing the sequence.
To create a passive webhook, set the task suffix to
started
. Selectingstarted
disables Send finished event, as no response is required to continue the sequence. This is the recommended option to ensure Dynatrace Cloud Automation processes sequences at the expected rate.Active webhooks stop a sequence from progressing until a response is received from xMatters.
To create an active webhook, set the task suffix to
triggered
, and then set Send finished event:- If you select
automatically
, the sequence continues without needing a response from xMatters, which is similar to a passive webhook. - If you select
by webhook receiver
, Cloud Automation stops the sequence and waits to receive a response from the xMatters Finish Cloud Automation Event step before continuing.
- If you select
-
Request method: Select
POST
.
-
-
Go through the steps below, according to your preferred authentication method.
- For URL, enter your trigger URL endpoint from your workflow template, making sure to add the users or groups you want to target in the recipient's query parameter.
Example:
https://mycompany.xmatters.com/api/integration/1/functions/83bcaca8-9afa-46bf-ade6-3c5b5c2d0218/triggers?apiKey={{.secret.xmatters.xmatters-auth}}&recipients=mygroup
You must URL-encode any special characters or spaces in the target names. To mask parts of the trigger URL, we recommend using a secret as above (see Prerequisites).
-
Select Add custom header, then enter the following values:
- Name: Enter
Content-Type
. - Value: Enter
application/json
.
- For URL, enter your trigger URL endpoint from your workflow template, making sure to add the users or groups you want to target in the recipient's query parameter.
Example:
https://mycompany.xmatters.com/api/integration/1/functions/83bcaca8-9afa-46bf-ade6-3c5b5c2d0218/triggers?recipients=mygroup
You must URL-encode any special characters or spaces in the target names.
-
Select Add custom header, then enter the following values:
-
Name: Enter
Authorization
. -
Value: Enter
{.secret.xmatters.xmatters-auth}
-
Select Add custom header once more, then enter the following values:
- Name: Enter
Content-Type
. - Value: Enter
application/json
.
- For URL, enter your trigger URL endpoint from your workflow template, making sure to add the users or groups you want to target in the recipient's query parameter.
Example:
https://mycompany.xmatters.com/api/integration/1/functions/83bcaca8-9afa-46bf-ade6-3c5b5c2d0218/triggers?recipients=mygroup
You must URL-encode any special characters or spaces in the target names.
-
Select Add custom header, then enter the following values:
-
Name: Enter
Authorization
. -
Value: Enter
{.secret.xmatters.xmatters-auth}
.
-
Select Add custom header once more, then enter the following values:
- Name: Enter
Content-Type
. - Value: Enter
application/json
.
-
Enter a Custom payload.
Example:
{ "data": { "project": "{{.data.project}}", "service": "{{.data.service}}", "stage": "{{.data.stage}}" }, "id": "{{.id}}", "source": "{{.source}}", "specversion": "{{.specversion}}", "time": "{{.time}}", "type": "{{.type}}", "shkeptncontext": "{{.shkeptncontext}}" }
-
Select Create subscription.
Trigger a sequence
Cloud Automation triggers an xMatters workflow whenever the defined task in the sequence is triggered.
To trigger the sequence, you can send the event command in the Keptn CLI. In the following example, there's a sequence called incident
and a task called runbook
.
-
Create a file called
triggered-event.json
.Example:
{ "type": "sh.keptn.event.mystage.incident.triggered", "specversion": "1.0", "source": "manual-trigger", "data": { "project": "myproject", "stage": "production", "service": "myservice" } }
-
Send the event.
keptn send event --file triggered-event.json