Dynatrace
In this example you are going to create a webhook integration between Dynatrace and Port, which will ingest problem entities to Port and map them to your microservice entities.
Prerequisitesโ
Create the following blueprint definitions and webhook configuration:
Dynatrace microservice blueprint
{
"identifier": "microservice",
"title": "Microservice",
"icon": "Service",
"schema": {
"properties": {
"description": {
"title": "Description",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
}
Dynatrace problem blueprint
{
"identifier": "dynatraceProblem",
"description": "This blueprint represents a Dynatrace problem in our software catalog",
"title": "Dynatrace Problem",
"icon": "Deployment",
"schema": {
"properties": {
"state": {
"type": "string",
"title": "Problem State"
},
"url": {
"type": "string",
"format": "url",
"title": "Problem URL"
},
"details": {
"type": "string",
"title": "Details"
},
"impact": {
"type": "string",
"title": "Problem Impact"
},
"severity": {
"type": "string",
"title": "Problem Severity"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"title": "Tags"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"microservice": {
"title": "Impacted Services",
"target": "microservice",
"required": false,
"many": true
}
}
}
Dynatrace problem webhook configuration
{
"identifier": "dynatraceProblemMapper",
"title": "Problem Mapper",
"description": "A webhook configuration for problem events from Dynatrace",
"icon": "Deployment",
"mappings": [
{
"blueprint": "dynatraceProblem",
"entity": {
"identifier": ".body.PID | tostring",
"title": ".body.ProblemTitle",
"properties": {
"state": ".body.State",
"url": ".body.ProblemURL",
"details": ".body.ProblemDetailsText",
"impact": ".body.ProblemImpact",
"severity": ".body.ProblemSeverity",
"tags": ".body.ProblemTags | split(\", \")"
},
"relations": {
"microservice": "[.body.ImpactedEntities[].entity]"
}
}
}
],
"enabled": true,
"security": {}
}
The webhook configuration's relation mapping will function properly only when the identifiers of the Port microservice entities match the names of the entities in your Dynatrace.
If there is a mismatch, you can utilize Dynatrace Tags to align the actual identifier in Port.
To do this, create a tag with the key proj and value <microservice_identifier>.
Then, update the relation JQ syntax to establish a connection between the Dynatrace problem and the Port microservice. Here is the updated JQ Mappings:
{
"blueprint": "dynatraceProblem",
"entity": {
...Properties mappings
"relations": {
"microservice": ".body.ProblemTags | split(\", \") | map(select(test(\"proj:\")) | sub(\"proj:\";\"\"))"
}
}
}
JQ expression explained
Create the Dynatrace webhookโ
- Log in to Dynatrace with your credentials;
- Click on Settings at the left sidebar of the page;
- Choose Integration and click on Problem notifications;
- Select Add notification;
- Select Custom integration from the available intregration types;
- Input the following details:
Display name
- use a meaningful name such as Port Webhook;Webhook URL
- enter the value of theurl
key you received after creating the webhook configuration;Overview
- you can add an optional HTTP header to your webhook request;Custom payload
- When a problem is detected or resolved on your entity, this payload will be sent to the webhook URL. You can enter this JSON placeholder in the textbox;{
"State":"{State}",
"PID":"{PID}",
"ProblemTitle":"{ProblemTitle}",
"ImpactedEntity": "{ImpactedEntity}",
"ProblemDetailsText": "{ProblemDetailsText}",
"ProblemImpact": "{ProblemImpact}",
"ProblemSeverity": "{ProblemSeverity}",
"ProblemURL": "{ProblemURL}",
"ProblemTags": "{Tags}",
"ImpactedEntities": {ImpactedEntities}
}Alerting profile
- configure your preferred alerting rule or use the default one;
- Click Save changes at the bottom of the page;
In order to view the different payloads and events available in Dynatrace webhooks, look here
Done! any problem detected on your Dynatrace entity will trigger a webhook event. Port will parse the events according to the mapping and update the catalog entities accordingly.