Datadog
In this example you are going to create a webhook integration between Datadog and Port, which will ingest alerts and monitors entities to Port and map them to your microservice entities.
Port configurationโ
Create the following blueprint definitions:
Datadog microservice blueprint
{
"identifier": "microservice",
"title": "Microservice",
"icon": "Service",
"schema": {
"properties": {
"description": {
"title": "Description",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
}
Datadog alert/monitor blueprint
{
"identifier": "datadogAlert",
"description": "This blueprint represents a Datadog monitor/alert in our software catalog",
"title": "Datadog Alert",
"icon": "Datadog",
"schema": {
"properties": {
"url": {
"type": "string",
"format": "url",
"title": "Event URL"
},
"message": {
"type": "string",
"title": "Details"
},
"eventType": {
"type": "string",
"title": "Event Type"
},
"priority": {
"type": "string",
"title": "Metric Priority"
},
"creator": {
"type": "string",
"title": "Creator"
},
"alertMetric": {
"type": "string",
"title": "Alert Metric"
},
"alertType": {
"type": "string",
"title": "Alert Type",
"enum": ["error", "warning", "success", "info"]
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"title": "Tags"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"microservice": {
"title": "Services",
"target": "microservice",
"required": false,
"many": false
}
}
}
Create the following webhook configuration using Port UI
Datadog webhook configuration
Basic details tab - fill the following details:
- Title :
Datadog Alert Mapper
; - Identifier :
datadog_alert_mapper
; - Description :
A webhook configuration for alerts/monitors events from Datadog
; - Icon :
Datadog
;
- Title :
Integration configuration tab - fill the following JQ mapping:
[
{
"blueprint": "datadogAlert",
"entity": {
"identifier": ".body.alert_id | tostring",
"title": ".body.title",
"properties": {
"url": ".body.event_url",
"message": ".body.message",
"eventType": ".body.event_type",
"priority": ".body.priority",
"creator": ".body.creator",
"alertMetric": ".body.alert_metric",
"alertType": ".body.alert_type",
"tags": ".body.tags | split(\", \")"
},
"relations": {
"microservice": ".body.service"
}
}
}
]Click Save at the bottom of the page.
The webhook configuration's relation mapping will function properly only when the identifiers of the Port microservice entities match the names of the services or hosts in your Datadog.
Create a webhook in Datadogโ
- Log in to Datadog with your credentials;
- Click on Integrations at the left sidebar of the page;
- Search for Webhooks in the search box and select it;
- Go to the Configuration tab and follow the installation instructions;
- Click on New;
- Input the following details:
Name
- use a meaningful name such as Port_Webhook;URL
- enter the value of theurl
key you received after creating the webhook configuration;Payload
- When an alert is triggered on your monitors, this payload will be sent to the webhook URL. You can enter this JSON placeholder in the textbox;{
"id": "$ID",
"message": "$TEXT_ONLY_MSG",
"priority": "$PRIORITY",
"last_updated": "$LAST_UPDATED",
"event_type": "$EVENT_TYPE",
"event_url": "$LINK",
"service": "$HOSTNAME",
"creator": "$USER",
"title": "$EVENT_TITLE",
"date": "$DATE",
"org_id": "$ORG_ID",
"org_name": "$ORG_NAME",
"alert_id": "$ALERT_ID",
"alert_metric": "$ALERT_METRIC",
"alert_status": "$ALERT_STATUS",
"alert_title": "$ALERT_TITLE",
"alert_type": "$ALERT_TYPE",
"tags": "$TAGS"
}Custom Headers
- configure any custom HTTP header to be added to the webhook event. The format for the header should be in JSON;
- Click Save at the bottom of the page;
In order to view the different payloads and structure of the events in Datadog webhooks, look here
Done! any problem detected on your Datadog instance will trigger a webhook event. Port will parse the events according to the mapping and update the catalog entities accordingly.
Ingest service level objectives (SLOs)โ
This guide will walk you through the steps to ingest Datadog SLOs into Port. By following these steps, you will be able to create a blueprint for a microservice
entity in Port, representing a service in your Datadog account. Furthermore, you will establish a relation between this service and the datadogSLO
blueprint, allowing the ingestion of all defined SLOs from your Datadog account.
The provided example demonstrates how to pull data from Datadog's REST API at scheduled intervals using GitLab Pipelines and report the data to Port.
Ingest service dependency from your APMโ
In this example, you will create a service
blueprint that ingests all services and their related dependencies in your Datadog APM using REST API. You will then add some shell script to create new entities in Port every time GitLab CI is triggered by a schedule.