OpsGenie
In this example you are going to create a webhook integration between OpsGenie and Port, which will ingest alert entities.
Prerequisitesโ
Create the following blueprint definition and webhook configuration:
OpsGenie alert blueprint
{
"identifier": "opsGenieAlert",
"description": "This blueprint represents an OpsGenie alert in our software catalog",
"title": "OpsGenie Alert",
"icon": "OpsGenie",
"schema": {
"properties": {
"description": {
"type": "string",
"title": "Description"
},
"lastChangeType": {
"type": "string",
"title": "Last Change Type",
"description": "The type of the last change made to the alert"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"title": "Tags"
},
"responders": {
"type": "array",
"title": "Responders",
"description": "Responders to the alert"
},
"teams": {
"type": "array",
"items": {
"type": "string"
},
"title": "Teams",
"description": "IDs of teams assigned to the alert"
},
"priority": {
"type": "string",
"title": "Priority"
},
"sourceName": {
"type": "string",
"title": "Source Name",
"description": "Alert source name"
},
"sourceType": {
"type": "string",
"title": "Source Type",
"description": "Alert source type"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {
"status": {
"title": "Status",
"calculation": "if .properties.lastChangeType == \"Close\" then \"Closed\" else \"Active\" end",
"type": "string",
"colorized": true,
"colors": {
"Closed": "green",
"Active": "red"
}
}
},
"relations": {}
}
OpsGenie alert webhook configuration
{
"identifier": "opsGenieMapper",
"title": "OpsGenie mapper",
"description": "A webhook configuration to map OpsGenie alerts to Port",
"icon": "OpsGenie",
"mappings": [
{
"blueprint": "opsGenieAlert",
"entity": {
"identifier": ".body.alert.alertId",
"title": ".body.alert.tinyId + \" - \" + .body.alert.message",
"properties": {
"description": ".body.alert.description",
"lastChangeType": ".body.action",
"priority": ".body.alert.priority",
"sourceName": ".body.source.name",
"sourceType": ".body.source.type",
"tags": ".body.alert.tags",
"responders": ".body.alert.responders",
"teams": ".body.alert.teams"
}
}
}
],
"enabled": true,
"security": {}
}
Create the OpsGenie webhookโ
- Go to OpsGenie;
- Select Settings;
- Click on Integrations under the Integrations section of the sidebar;
- Click on Add integration;
- In the search box, type Webhook and select the webhook option;
- Input the following details:
Name
- use a meaningful name such as Port Webhook;- Be sure to keep the "Enabled" checkbox checked;
- Check the "Add Alert Description to Payload" checkbox;
- Check the "Add Alert Details to Payload" checkbox;
- Add the following action triggers to the webhook by clicking on Add new action:
- If alert is snoozed in Opsgenie, post to url in Webhook;
- If alert's description is updated in Opsgenie, post to url in Webhook;
- If alert's message is updated in Opsgenie, post to url in Webhook;
- If alert's priority is updated in Opsgenie, post to url in Webhook;
- If a responder is added to the alert in Opsgenie, post to url in Webhook;
- if a user executes "Assign Ownership in Opsgenie, post to url in Webhook;
- if a tag is added to the alert in Opsgenie, post to url in Webhook;
- .if a tag is removed from the alert in Opsgenie, post to url in Webhook;
Webhook URL
- enter the value of theurl
key you received after creating the webhook configuration;
- Click Save integration
In order to view the different payloads and events available in Opsgenie webhooks, look here
Done! any change that happens to an OpsGenie alert (created, acknowledged, etc.) will trigger a webhook event that OpsGenie will send to the webhook URL provided by Port. Port will parse the events according to the mapping and update the catalog entities accordingly.
Ingest who is on-callโ
In this example we will create a blueprint for service
entities with an on-call
property that will be ingested directly from OpsGenie.
The examples below pull data from the OpsGenie REST Api, in a defined scheduled period using GitLab Pipelines or GitHub Workflows, and report the data to Port as a property to the service
blueprint.