Opsgenie
Port's Opsgenie integration allows you to model Opsgenie resources in your software catalog and ingest data into them.
Overviewโ
This integration allows you to:
- Map and organize your desired Opsgenie resources and their metadata in Port (see supported resources below).
- Watch for Opsgenie object changes (create/update/delete) in real-time, and automatically apply the changes to your entities in Port.
Supported Resourcesโ
The resources that can be ingested from Opsgenie into Port are listed below. It is possible to reference any field that appears in the API responses linked below in the mapping configuration.
Setupโ
Choose one of the following installation methods:
- Hosted by Port
- Real-time (self-hosted)
- Scheduled (CI)
Using this installation option means that the integration will be hosted by Port, with a customizable resync interval to ingest data into Port.
Live event support
Currently, live events are not supported for integrations hosted by Port.
Resyncs will be performed periodically (with a configurable interval), or manually triggered by you via Port's UI.
Therefore, real-time events (including GitOps) will not be ingested into Port immediately.
Support for live events is WIP and will be supported in the near future.
Alternatively, you can install the integration using the Real-time (self-hosted) method to update Port in real time using webhooks.
Installation
To install, follow these steps:
-
Go to the Data sources page of your portal.
-
Click on the
+ Data source
button in the top-right corner. -
Click on the relevant integration in the list.
-
Under
Select your installation method
, chooseHosted by Port
. -
Configure the
integration settings
andapplication settings
as you wish (see below for details).
Application settings
Every integration hosted by Port has the following customizable application settings, which are configurable after installation:
-
Resync interval
: The frequency at which Port will ingest data from the integration. There are various options available, ranging from every 1 hour to once a day. -
Send raw data examples
: A boolean toggle (enabled
by default). If enabled, raw data examples will be sent from the integration to Port. These examples are used when testing your mapping configuration, they allow you to run yourjq
expressions against real data and see the results.
Integration settings
Every integration has its own tool-specific settings, under the Integration settings
section.
Each of these settings has an โ icon next to it, which you can hover over to see a description of the setting.
Port secrets
Some integration settings require sensitive pieces of data, such as tokens.
For these settings, Port secrets will be used, ensuring that your sensitive data is encrypted and secure.
When filling in such a setting, its value will be obscured (shown as โขโขโขโขโขโขโขโข
).
For each such setting, Port will automatically create a secret in your organization.
To see all secrets in your organization, follow these steps.
Port source IP addresses
When using this installation method, Port will make outbound calls to your 3rd-party applications from static IP addresses.
You may need to add these addresses to your allowlist, in order to allow Port to interact with the integrated service:
- Europe (EU)
- United States (US)
54.73.167.226
63.33.143.237
54.76.185.219
3.234.37.33
54.225.172.136
3.225.234.99
Using this installation option means that the integration will be able to update Port in real time using webhooks.
Prerequisites
An OpsGenie API token with the read
and configuration access
scopes is required. Port requires the read
permission to allow the integration to access incidents and alerts. Port also needs the configuration access
permission to allow the integration to access service, teams, and schedules. See here for more information on OpsGenie API key management.
To install the integration, you need a Kubernetes cluster that the integration's container chart will be deployed to.
Please make sure that you have kubectl
and helm
installed on your machine, and that your kubectl
CLI is connected to the Kubernetes cluster where you plan to install the integration.
If you are having trouble installing this integration, please refer to these troubleshooting steps.
For details about the available parameters for the installation, see the table below.
- Helm
- ArgoCD
To install the integration using Helm:
-
Go to the Opsgenie data source page in your portal.
-
Select the
Real-time and always on
method: -
A
helm
command will be displayed, with default values already filled out (e.g. your Port cliend ID, client secret, etc).
Copy the command, replace the placeholders with your values, then run it in your terminal to install the integration.
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
To install the integration using ArgoCD:
- Create a
values.yaml
file inargocd/my-ocean-opsgenie-integration
in your git repository with the content:
Remember to replace the placeholders for OPSGENIE_API_URL
and OPSGENIE_API_TOKEN
.
initializePortResources: true
scheduledResyncInterval: 120
integration:
identifier: my-ocean-opsgenie-integration
type: opsgenie
eventListener:
type: POLLING
config:
apiUrl: OPSGENIE_API_URL
secrets:
apiToken: OPSGENIE_API_TOKEN
- Install the
my-ocean-opsgenie-integration
ArgoCD Application by creating the followingmy-ocean-opsgenie-integration.yaml
manifest:
Remember to replace the placeholders for YOUR_PORT_CLIENT_ID
YOUR_PORT_CLIENT_SECRET
and YOUR_GIT_REPO_URL
.
Multiple sources ArgoCD documentation can be found here.
ArgoCD Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-ocean-opsgenie-integration
namespace: argocd
spec:
destination:
namespace: my-ocean-opsgenie-integration
server: https://kubernetes.default.svc
project: default
sources:
- repoURL: 'https://port-labs.github.io/helm-charts/'
chart: port-ocean
targetRevision: 0.1.14
helm:
valueFiles:
- $values/argocd/my-ocean-opsgenie-integration/values.yaml
parameters:
- name: port.clientId
value: YOUR_PORT_CLIENT_ID
- name: port.clientSecret
value: YOUR_PORT_CLIENT_SECRET
- name: port.baseUrl
value: https://api.getport.io
- repoURL: YOUR_GIT_REPO_URL
targetRevision: main
ref: values
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
- Apply your application manifest with
kubectl
:
kubectl apply -f my-ocean-opsgenie-integration.yaml
This table summarizes the available parameters for the installation. The parameters specific to this integration are last in the table.
Parameter | Description | Required |
---|---|---|
port.clientId | Your port client id | โ |
port.clientSecret | Your port client secret | โ |
port.baseUrl | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | โ |
integration.identifier | Change the identifier to describe your integration | โ |
integration.type | The integration type | โ |
scheduledResyncInterval | The number of minutes between each resync | โ |
initializePortResources | Default true, When set to true the integration will create default blueprints and the port App config Mapping | โ |
sendRawDataExamples | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | โ |
integration.eventListener.type | The event listener type | โ |
integration.secrets.apiToken | The Opsgenie API token, docs can be found here | โ |
integration.config.apiUrl | The Opsgenie API URL. If not specified, the default will be https://api.opsgenie.com | โ |
For advanced configuration such as proxies or self-signed certificates, click here.
This workflow/pipeline will run the Opsgenie integration once and then exit, this is useful for scheduled ingestion of data.
If you want the integration to update Port in real time using webhooks you should use the Real-time (self-hosted) installation option
- GitHub
- Jenkins
- Azure Devops
- GitLab
Make sure to configure the following Github Secrets:
Parameter | Description | Required |
---|---|---|
OCEAN__INTEGRATION__CONFIG__API_TOKEN | The Opsgenie API token | โ |
OCEAN__INTEGRATION__CONFIG__API_URL | The Opsgenie API URL | โ |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to false the integration will not create default blueprints and the port App config Mapping | โ |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | โ |
OCEAN__INTEGRATION__IDENTIFIER | Change the identifier to describe your integration, if not set will use the default one | โ |
OCEAN__PORT__CLIENT_ID | Your port client id | โ |
OCEAN__PORT__CLIENT_SECRET | Your port client secret | โ |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | โ |
Here is an example for opsgenie-integration.yml
workflow file:
name: Opsgenie Exporter Workflow
on:
workflow_dispatch:
schedule:
- cron: '0 */1 * * *' # Determines the scheduled interval for this workflow. This example runs every hour.
jobs:
run-integration:
runs-on: ubuntu-latest
timeout-minutes: 30 # Set a time limit for the job
steps:
- uses: port-labs/ocean-sail@v1
with:
type: 'opsgenie'
port_client_id: ${{ secrets.OCEAN__PORT__CLIENT_ID }}
port_client_secret: ${{ secrets.OCEAN__PORT__CLIENT_SECRET }}
port_base_url: https://api.getport.io
config: |
api_token: ${{ secrets.OCEAN__INTEGRATION__CONFIG__API_TOKEN }}
api_url: ${{ secrets.OCEAN__INTEGRATION__CONFIG__API_URL }}
Your Jenkins agent should be able to run docker commands.
Make sure to configure the following Jenkins Credentials
of Secret Text
type:
Parameter | Description | Required |
---|---|---|
OCEAN__INTEGRATION__CONFIG__API_TOKEN | The Opsgenie API token | โ |
OCEAN__INTEGRATION__CONFIG__API_URL | The Opsgenie API URL | โ |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to false the integration will not create default blueprints and the port App config Mapping | โ |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | โ |
OCEAN__INTEGRATION__IDENTIFIER | Change the identifier to describe your integration, if not set will use the default one | โ |
OCEAN__PORT__CLIENT_ID | Your port client id | โ |
OCEAN__PORT__CLIENT_SECRET | Your port client secret | โ |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | โ |
Here is an example for Jenkinsfile
groovy pipeline file:
pipeline {
agent any
stages {
stage('Run Opsgenie Integration') {
steps {
script {
withCredentials([
string(credentialsId: 'OCEAN__INTEGRATION__CONFIG__API_TOKEN', variable: 'OCEAN__INTEGRATION__CONFIG__API_TOKEN'),
string(credentialsId: 'OCEAN__INTEGRATION__CONFIG__API_URL', variable: 'OCEAN__INTEGRATION__CONFIG__API_URL'),
string(credentialsId: 'OCEAN__PORT__CLIENT_ID', variable: 'OCEAN__PORT__CLIENT_ID'),
string(credentialsId: 'OCEAN__PORT__CLIENT_SECRET', variable: 'OCEAN__PORT__CLIENT_SECRET'),
]) {
sh('''
#Set Docker image and run the container
integration_type="opsgenie"
version="latest"
image_name="ghcr.io/port-labs/port-ocean-${integration_type}:${version}"
docker run -i --rm --platform=linux/amd64 \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__API_TOKEN=$OCEAN__INTEGRATION__CONFIG__API_TOKEN \
-e OCEAN__INTEGRATION__CONFIG__API_URL=$OCEAN__INTEGRATION__CONFIG__API_URL \
-e OCEAN__PORT__CLIENT_ID=$OCEAN__PORT__CLIENT_ID \
-e OCEAN__PORT__CLIENT_SECRET=$OCEAN__PORT__CLIENT_SECRET \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$image_name
exit $?
''')
}
}
}
}
}
}
Your Azure Devops agent should be able to run docker commands. Learn more about agents here.
Variable groups store values and secrets you'll use in your pipelines across your project. Learn more
Setting Up Your Credentials
- Create a Variable Group: Name it port-ocean-credentials.
- Store the required variables (see the table below).
- Authorize Your Pipeline:
- Go to "Library" -> "Variable groups."
- Find port-ocean-credentials and click on it.
- Select "Pipeline Permissions" and add your pipeline to the authorized list.
Parameter | Description | Required |
---|---|---|
OCEAN__INTEGRATION__CONFIG__API_TOKEN | The Opsgenie API token | โ |
OCEAN__INTEGRATION__CONFIG__API_URL | The Opsgenie API URL | โ |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to false the integration will not create default blueprints and the port App config Mapping | โ |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | โ |
OCEAN__INTEGRATION__IDENTIFIER | Change the identifier to describe your integration, if not set will use the default one | โ |
OCEAN__PORT__CLIENT_ID | Your port client id | โ |
OCEAN__PORT__CLIENT_SECRET | Your port client secret | โ |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | โ |
Here is an example for opsgenie-integration.yml
pipeline file:
trigger:
- main
pool:
vmImage: "ubuntu-latest"
variables:
- group: port-ocean-credentials
steps:
- script: |
# Set Docker image and run the container
integration_type="opsgenie"
version="latest"
image_name="ghcr.io/port-labs/port-ocean-$integration_type:$version"
docker run -i --rm --platform=linux/amd64 \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__API_TOKEN=$(OCEAN__INTEGRATION__CONFIG__API_TOKEN) \
-e OCEAN__INTEGRATION__CONFIG__API_URL=$(OCEAN__INTEGRATION__CONFIG__API_URL) \
-e OCEAN__PORT__CLIENT_ID=$(OCEAN__PORT__CLIENT_ID) \
-e OCEAN__PORT__CLIENT_SECRET=$(OCEAN__PORT__CLIENT_SECRET) \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$image_name
exit $?
displayName: 'Ingest Data into Port'
Make sure to configure the following GitLab variables:
Parameter | Description | Required |
---|---|---|
OCEAN__INTEGRATION__CONFIG__API_TOKEN | The Opsgenie API token | โ |
OCEAN__INTEGRATION__CONFIG__API_URL | The Opsgenie API URL | โ |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to false the integration will not create default blueprints and the port App config Mapping | โ |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | โ |
OCEAN__INTEGRATION__IDENTIFIER | Change the identifier to describe your integration, if not set will use the default one | โ |
OCEAN__PORT__CLIENT_ID | Your port client id | โ |
OCEAN__PORT__CLIENT_SECRET | Your port client secret | โ |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | โ |
Here is an example for .gitlab-ci.yml
pipeline file:
default:
image: docker:24.0.5
services:
- docker:24.0.5-dind
before_script:
- docker info
variables:
INTEGRATION_TYPE: opsgenie
VERSION: latest
stages:
- ingest
ingest_data:
stage: ingest
variables:
IMAGE_NAME: ghcr.io/port-labs/port-ocean-$INTEGRATION_TYPE:$VERSION
script:
- |
docker run -i --rm --platform=linux/amd64 \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__API_TOKEN=$OCEAN__INTEGRATION__CONFIG__API_TOKEN \
-e OCEAN__INTEGRATION__CONFIG__API_URL=$OCEAN__INTEGRATION__CONFIG__API_URL \
-e OCEAN__PORT__CLIENT_ID=$OCEAN__PORT__CLIENT_ID \
-e OCEAN__PORT__CLIENT_SECRET=$OCEAN__PORT__CLIENT_SECRET \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$IMAGE_NAME
rules: # Run only when changes are made to the main branch
- if: '$CI_COMMIT_BRANCH == "main"'
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
For advanced configuration such as proxies or self-signed certificates, click here.
Configurationโ
Port integrations use a YAML mapping block to ingest data from the third-party api into Port.
The mapping makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from the integration API.
Capabilitiesโ
Configure real-time updatesโ
Currently, the OpsGenie API lacks support for programmatic webhook creation. To set up a webhook configuration in OpsGenie for sending alert notifications to the Ocean integration, follow these steps:
Prerequisitesโ
Prepare a webhook URL
using this format: {app_host}/integration/webhook
.
The app_host
parameter should match the ingress or external load balancer where the integration will be deployed.
For example, if your ingress or load balancer exposes the OpsGenie Ocean integration at https://myservice.domain.com
, your webhook URL
should be https://myservice.domain.com/integration/webhook
.
Create a webhook in OpsGenieโ
- 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 Ocean 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
you created above.
- Click Save integration.
Examplesโ
To view and test the integration's mapping against examples of the third-party API responses, use the jq playground in your data sources page. Find the integration in the list of data sources and click on it to open the playground.
Examples of blueprints and the relevant integration configurations can be found on the opsgenie examples page
Let's Test Itโ
This section includes a sample response data from Opsgenie. In addition, it includes the entity created from the resync event based on the Ocean configuration provided in the previous section.
Payloadโ
Here is an example of the payload structure from Opsgenie:
User response data
{
"blocked": false,
"verified": true,
"id": "45d6-b25e-6a7aae22423b-3e28d924-840d",
"username": "jane.doe@gmail.com",
"fullName": "Jane Doe",
"role": {
"id": "Admin",
"name": "Admin"
},
"timeZone": "Asia/Jerusalem",
"locale": "en_US",
"userAddress": {
"country": "",
"state": "",
"city": "",
"line": "",
"zipCode": ""
},
"createdAt": "2023-09-26T07:57:24.246Z"
}
Team response data
{
"id": "63374eee-0b03-42d4-bb8c-50d1fa64827c",
"name": "Data Science Team",
"description": "",
"links": {
"web": "https://app.opsgenie.com/teams/dashboard/63374eee-0b03-42d4-bb8c-50d1fa64827c/main",
"api": "https://api.opsgenie.com/v2/teams/63374eee-0b03-42d4-bb8c-50d1fa64827c"
}
}
Schedule response data
{
"item": {
"id": "c4fa16f1-8675-4a26-9c2a-7b7a0c98a9cb",
"name": "Rota2",
"startDate": "2024-09-02T08:00:00Z",
"endDate": "2024-09-14T09:00:00Z",
"type": "weekly",
"length": 3,
"participants": [
{
"type": "user",
"id": "ce544b61-7b35-43ea-89ee-a8750638d3a4",
"username": "dev@domain.com"
}
],
"timeRestriction": null
},
"id": "977805c9-ede6-4cc1-a535-93e93767a436",
"name": "Devops Team_schedule",
"description": "",
"timezone": "Africa/Monrovia",
"enabled": true,
"ownerTeam": {
"id": "bae765bb-a288-4731-b826-b2c65ff16f24",
"name": "Devops Team"
},
"rotations": [
{
"id": "c4fa16f1-8675-4a26-9c2a-7b7a0c98a9cb",
"name": "Rota2",
"startDate": "2024-09-02T08:00:00Z",
"endDate": "2024-09-14T09:00:00Z",
"type": "weekly",
"length": 3,
"participants": [
{
"type": "user",
"id": "ce544b61-7b35-43ea-89ee-a8750638d3a4",
"username": "dev@domain.com"
}
],
"timeRestriction": null
},
{
"id": "1fbeb5b1-4e00-483e-ab01-323881535159",
"name": "Rota1",
"startDate": "2024-09-02T08:00:00Z",
"endDate": "2024-09-10T09:00:00Z",
"type": "weekly",
"length": 1,
"participants": [
{
"type": "user",
"id": "ce544b61-7b35-43ea-89ee-a8750638d3a4",
"username": "dev@domain.com"
}
],
"timeRestriction": null
}
]
}
Service response data
{
"id": "96856ebc-1db0-497b-b90a-5172e6ca0cb3",
"name": "Pricing Service",
"description": "Product pricing algorithm service",
"teamId": "63374eee-0b03-42d4-bb8c-50d1fa64827c",
"tags": [
"frontend"
],
"links": {
"web": "https://mydomain.app.opsgenie.com/service/96856ebc-1db0-497b-b90a-5172e6ca0cb3/status",
"api": "https://api.opsgenie.com/v1/services/96856ebc-1db0-497b-b90a-5172e6ca0cb3"
},
"isExternal": false
}
Incident response data
{
"id": "652f14b3-019a-4d4c-8b83-e4da527a416c",
"description": "summary",
"impactedServices": [
"daa0d66f-ad35-4396-b30d-70f0314c697a"
],
"tinyId": "3",
"message": "OpenAI Token Incident",
"status": "open",
"tags": [
"incident"
],
"createdAt": "2023-09-26T17:06:16.824Z",
"updatedAt": "2023-09-26T17:49:10.17Z",
"priority": "P3",
"ownerTeam": "",
"responders": [
{
"type": "team",
"id": "63374eee-0b03-42d4-bb8c-50d1fa64827c"
},
{
"type": "user",
"id": "ce544b61-7b35-43ea-89ee-a8750638d3a4"
}
],
"extraProperties": {},
"links": {
"web": "https://mydomain.app.opsgenie.com/incident/detail/652f14b3-019a-4d4c-8b83-e4da527a416c",
"api": "https://api.opsgenie.com/v1/incidents/652f14b3-019a-4d4c-8b83-e4da527a416c"
},
"impactStartDate": "2023-09-26T17:06:16.824Z",
"impactEndDate": "2023-09-26T17:45:25.719Z",
"actions": []
}
Alert response data
{
"seen": true,
"id": "886b285b-b35e-487b-afe6-3d5001370363-1724857097467",
"tinyId": "13",
"alias": "355f1681-f6e3-4355-a927-897cd8edaf8f_886b285b-b35e-487b-afe6-3d5001370363-1724857097467",
"message": "Test scaling alerts",
"status": "open",
"acknowledged": false,
"isSeen": true,
"tags": [],
"snoozed": false,
"count": 1,
"lastOccurredAt": "2024-08-28T14:58:17.467Z",
"createdAt": "2024-08-28T14:58:17.467Z",
"updatedAt": "2024-08-28T14:58:59.285Z",
"source": "dev@domain.com",
"owner": "",
"priority": "P3",
"teams": [],
"responders": [
{
"type": "user",
"id": "ce544b61-7b35-43ea-89ee-a8750638d3a4"
}
],
"integration": {
"id": "00c228b7-80a4-48ae-be9c-3a1471bad69d",
"name": "Default API",
"type": "API"
},
"ownerTeamId": ""
}
Oncall response data
{
"id": "977805c9-ede6-4cc1-a535-93e93767a436",
"name": "Devops Team_schedule",
"description": "",
"timezone": "Africa/Monrovia",
"enabled": true,
"ownerTeam": {
"id": "bae765bb-a288-4731-b826-b2c65ff16f24",
"name": "Devops Team"
},
"rotations": [],
"__currentOncalls": {
"_parent": {
"id": "977805c9-ede6-4cc1-a535-93e93767a436",
"name": "Devops Team_schedule",
"enabled": true
},
"onCallRecipients": [
"dev@domain.com"
]
}
}
Mapping Resultโ
The combination of the sample payload and the Ocean configuration generates the following Port entity:
User entity in Port
{
"identifier": "45d6-b25e-6a7aae22423b-3e28d924-840d",
"title": "Jane Doe",
"icon": "OpsGenie",
"blueprint": "opsGenieUser",
"team": [],
"properties": {
"email": "jane.doe@gmail.com",
"role": "Admin",
"timeZone": "Asia/Jerusalem",
"isVerified": true,
"isBlocked": false,
"address": {
"country": "",
"state": "",
"city": "",
"line": "",
"zipCode": ""
},
"createdAt": "2023-09-26T07:57:24.246Z"
},
"relations": {},
"createdAt": "2024-10-02T21:01:40.937Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2024-10-02T21:01:40.937Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Team entity in Port
{
"identifier": "63374eee-0b03-42d4-bb8c-50d1fa64827c",
"title": "Data Science Team",
"icon": "OpsGenie",
"blueprint": "opsGenieTeam",
"team": [],
"properties": {
"description": "",
"url": "https://app.opsgenie.com/teams/dashboard/63374eee-0b03-42d4-bb8c-50d1fa64827c/main"
},
"relations": {},
"createdAt": "2024-09-02T21:01:40.937Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2024-09-02T21:01:40.937Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Schedule entity in Port
{
"identifier": "d55e148e-d320-4766-9dcf-4fc2ce9daef1_fefc6b88-e44d-4acc-93a2-daf3ba803690",
"title": "Data Science Team_schedule_Rota3",
"icon": "OpsGenie",
"blueprint": "opsGenieSchedule",
"team": [],
"properties": {
"timezone": "Africa/Monrovia",
"description": "",
"users": [],
"startDate": "2024-09-02T08:00:00Z",
"endDate": "2024-10-02T08:00:00Z",
"rotationType": "daily"
},
"relations": {
"ownerTeam": "63374eee-0b03-42d4-bb8c-50d1fa64827c"
},
"createdAt": "2024-09-10T12:24:02.999Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2024-09-10T12:24:02.999Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Service entity in Port
{
"identifier": "96856ebc-1db0-497b-b90a-5172e6ca0cb3",
"title": "Pricing Service",
"icon": "OpsGenie",
"blueprint": "opsGenieService",
"team": [],
"properties": {
"description": "Product pricing algorithm service",
"url": "https://mydomain.app.opsgenie.com/service/96856ebc-1db0-497b-b90a-5172e6ca0cb3/status",
"tags": [
"frontend"
],
"oncallUsers": [
"dev@domain.com"
],
"numberOfOpenIncidents": null
},
"relations": {
"ownerTeam": null
},
"createdAt": "2024-09-02T21:02:01.207Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2024-09-02T21:02:01.207Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Incident entity in Port
{
"identifier": "652f14b3-019a-4d4c-8b83-e4da527a416c",
"title": "OpenAI Token Incident",
"icon": "OpsGenie",
"blueprint": "opsGenieIncident",
"team": [],
"properties": {
"description": "summary",
"status": "open",
"url": "https://mydomain.app.opsgenie.com/incident/detail/652f14b3-019a-4d4c-8b83-e4da527a416c",
"tags": [
"tags"
],
"responders": [
{
"id": "63374eee-0b03-42d4-bb8c-50d1fa64827c",
"type": "team"
},
{
"id": "ce544b61-7b35-43ea-89ee-a8750638d3a4",
"type": "user"
}
],
"priority": "P3",
"createdAt": "2023-09-26T17:06:16.824Z",
"updatedAt": "2023-09-26T17:49:10.17Z"
},
"relations": {
"services": [
"daa0d66f-ad35-4396-b30d-70f0314c697a"
]
},
"createdAt": "2024-08-28T16:58:15.414Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2024-08-28T16:58:15.414Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Alert entity in Port
{
"identifier": "886b285b-b35e-487b-afe6-3d5001370363-1724857097467",
"title": "Test scaling alerts",
"icon": "OpsGenie",
"blueprint": "opsGenieAlert",
"team": [],
"properties": {
"description": null,
"status": "open",
"acknowledged": false,
"tags": [],
"responders": [
{
"id": "ce544b61-7b35-43ea-89ee-a8750638d3a4",
"type": "user"
}
],
"integration": "Default API",
"priority": "P3",
"sourceName": "dev@domain.com",
"createdBy": "",
"createdAt": "2024-08-28T14:58:17.467Z",
"updatedAt": "2024-08-28T14:58:59.285Z",
"count": 1
},
"relations": {
"relatedIncident": "355f1681-f6e3-4355-a927-897cd8edaf8f"
},
"createdAt": "2024-08-29T10:31:34.381Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2024-08-29T10:31:34.381Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Oncall entity in Port
{
"identifier": "63374eee-0b03-42d4-bb8c-50d1fa64827c",
"title": "Data Science Team",
"icon":"OpsGenie",
"blueprint": "opsGenieTeam",
"team": [],
"properties": {
"description": "",
"url": "https://app.opsgenie.com/teams/dashboard/63374eee-0b03-42d4-bb8c-50d1fa64827c/main",
"oncallUsers": [
"janedoe@devportal.io",
"johnsmith@gmail.com",
"dev@domain.com"
]
},
"relations": {},
"createdAt": "2024-09-02T21:01:40.937Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2024-09-10T11:41:09.535Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Alternative installation via webhookโ
While the Ocean integration described above is the recommended installation method, you may prefer to use a webhook to ingest data from Opsgenie. If so, use the following instructions:
Webhook installation (click to expand)
In this example you are going to create a webhook integration between OpsGenie and Port, which will ingest alert entities.
Port configurationโ
Create the following blueprint definition:
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": {}
}
Create the following webhook configuration using Port UI:
OpsGenie alert webhook configuration
-
Basic details tab - fill the following details:
- Title :
OpsGenie mapper
; - Identifier :
opsgenie_mapper
; - Description :
A webhook configuration to map OpsGenie alerts to Port
; - Icon :
OpsGenie
;
- Title :
-
Integration configuration tab - fill the following JQ mapping:
[
{
"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"
}
}
}
] -
Click Save at the bottom of the page.
Create a webhook in OpsGenie
- 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.
Let's Test It
This section includes a sample webhook event sent from OpsGenie when an alert is created. In addition, it includes the entity created from the event based on the webhook configuration provided in the previous section.
Payload
Here is an example of the payload structure sent to the webhook URL when an OpsGenie alert is created:
Webhook event payload
{
"source": {
"name": "web",
"type": "API"
},
"alert": {
"tags": ["tag1", "tag2"],
"teams": ["team1", "team2"],
"responders": ["recipient1", "recipient2"],
"message": "test alert",
"username": "username",
"alertId": "052652ac-5d1c-464a-812a-7dd18bbfba8c",
"source": "user@domain.com",
"alias": "aliastest",
"tinyId": "10",
"entity": "An example entity",
"createdAt": 1686916265415,
"updatedAt": 1686916266116,
"userId": "daed1180-0ce8-438b-8f8e-57e1a5920a2d",
"description": "Testing opsgenie alerts",
"priority": "P1"
},
"action": "Create",
"integrationId": "37c8f316-17c6-49d7-899b-9c7e540c048d",
"integrationName": "Port-Integration"
}
Mapping Result
The combination of the sample payload and the webhook configuration generates the following Port entity:
{
"identifier": "052652ac-5d1c-464a-812a-7dd18bbfba8c",
"title": "10 - test alert",
"blueprint": "opsGenieAlert",
"properties": {
"description": "Testing opsgenie alerts",
"lastChangeType": "Create",
"priority": "P1",
"sourceName": "web",
"sourceType": "API",
"tags": ["tag1", "tag2"],
"responders": ["recipient1", "recipient2"],
"teams": ["team1", "team2"]
},
"relations": {}
}
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.
Migration Guide to Version 0.2.0โ
This guide outlines how to update your existing OpsGenie integration configuration to take advantage of the performance improvements and breaking changes introduced in version 0.2.0.
Key Improvementsโ
- New Blueprints and Kinds: Added new kinds for team, schedule, and schedule-oncall.
- Data Filtering: Introduced support for filtering data from the OpsGenie API to fetch only the necessary information.
- Enhanced Logging: Added logs for easier debugging and better insight into integration issues.
Breaking Changesโ
- Optimized API Calls: Removed redundant API calls for fetching impacted services and alert-incident relationships, improving performance by leveraging existing relations and JQ
- Blueprint Changes: The
OpsGenieService
blueprint no longer contains team properties likeoncallTeam
,teamMembers
, andoncallUsers
. These have been moved to a newOpsGenieTeam
blueprint, reflecting a new relation between services and teams.
Migration Stepsโ
Step 1: Understand Existing Configuration
In versions prior to 0.2.0, your Port app's configuration may have used a mapping like the one below:
Existing configuration (click to expand)
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: service
selector:
query: 'true'
port:
entity:
mappings:
identifier: .name | gsub("[^a-zA-Z0-9@_.:/=-]"; "-") | tostring
title: .name
blueprint: '"opsGenieService"'
properties:
description: .description
url: .links.web
tags: .tags
oncallTeam: .__team.name
teamMembers: '[.__team.members[].user.username]'
oncallUsers: .__oncalls.onCallRecipients
- kind: alert
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .message
blueprint: '"opsGenieAlert"'
properties:
status: .status
acknowledged: .acknowledged
responders: .responders
priority: .priority
sourceName: .source
tags: .tags
count: .count
createdBy: .owner
createdAt: .createdAt
updatedAt: .updatedAt
description: .description
integration: .integration.name
relations:
relatedIncident: .__relatedIncident.id
- kind: incident
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .message
blueprint: '"opsGenieIncident"'
properties:
status: .status
responders: .responders
priority: .priority
tags: .tags
url: .links.web
createdAt: .createdAt
updatedAt: .updatedAt
description: .description
relations:
services: '[.__impactedServices[] | .name | gsub("[^a-zA-Z0-9@_.:/=-]"; "-") | tostring]'
Step 2: Update to New Configuration
To adapt to version 0.2.0, you will need to update your configuration as follows:
New configuration (click to expand)
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: service
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id # The identifier of the service now uses the unique ID from OpsGenie instead of the name
title: .name
blueprint: '"opsGenieService"'
properties:
description: .description
url: .links.web
tags: .tags
- kind: alert
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .message
blueprint: '"opsGenieAlert"'
properties:
status: .status
acknowledged: .acknowledged
responders: .responders
priority: .priority
sourceName: .source
tags: .tags
count: .count
createdBy: .owner
createdAt: .createdAt
updatedAt: .updatedAt
description: .description
integration: .integration.name
relations:
relatedIncident: 'if (.alias | contains("_")) then (.alias | split("_")[0]) else null end' # We now use JQ logic to map alerts to incidents to avoid making extra API call
- kind: incident
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .message
blueprint: '"opsGenieIncident"'
properties:
status: .status
responders: .responders
priority: .priority
tags: .tags
url: .links.web
createdAt: .createdAt
updatedAt: .updatedAt
description: .description
relations:
services: .impactedServices # We can now directly map incidents to impacted services using the data that is coming from the API
In the updated configuration, the opsGenieService
blueprint no longer includes properties like oncallTeam
, teamMembers
, and oncallUsers
. These properties are now part of the new OpsGenieTeam
blueprint. If you need to track on-call teams and users for each service, follow the steps below.
Step 3: Create the OpsGenieTeam Blueprint
To manage team-related data, create a new OpsGenieTeam
blueprint in Port using the following schema:
OpsGenie team blueprint (click to expand)
{
"identifier": "opsGenieTeam",
"description": "This blueprint represents an OpsGenie team in our software catalog",
"title": "OpsGenie Team",
"icon": "OpsGenie",
"schema": {
"properties": {
"description": {
"type": "string",
"title": "Description",
"icon": "DefaultProperty"
},
"url": {
"title": "URL",
"type": "string",
"description": "URL to the service",
"format": "url",
"icon": "DefaultProperty"
},
"oncallUsers": {
"type": "array",
"title": "Current Oncalls",
"items": {
"type": "string",
"format": "user"
}
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
Step 4: Update the OpsGenieService Blueprint
Next, update the opsGenieService
blueprint to reference the OpsGenieTeam
blueprint by establishing a relation and mirroring relevant properties:
Updated OpsGenie service blueprint (click to expand)
{
"identifier": "opsGenieService",
"description": "This blueprint represents an OpsGenie service in our software catalog",
"title": "OpsGenie Service",
"icon": "OpsGenie",
"schema": {
"properties": {
"description": {
"type": "string",
"title": "Description",
"icon": "DefaultProperty"
},
"url": {
"title": "URL",
"type": "string",
"description": "URL to the service",
"format": "url",
"icon": "DefaultProperty"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"title": "Tags",
"icon": "DefaultProperty"
}
},
"required": []
},
"mirrorProperties": {
"oncallUsers": {
"title": "Current Oncalls",
"path": "ownerTeam.oncallUsers"
}
},
"calculationProperties": {
},
"aggregationProperties": {
"numberOfOpenIncidents": {
"title": "Number of open incidents",
"type": "number",
"target": "opsGenieIncident",
"query": {
"combinator": "and",
"rules": [
{
"property": "status",
"operator": "=",
"value": "open"
}
]
},
"calculationSpec": {
"calculationBy": "entities",
"func": "count"
}
}
},
"relations": {
"ownerTeam": {
"title": "Owner Team",
"target": "opsGenieTeam",
"required": false,
"many": false
}
}
}
Step 5: Update the Mapping Configuration
Update your configuration mapping to correctly populate the OpsGenieTeam
blueprint with team and on-call data. This will enable you to view on-call team information at the service level:
Updated configuration to add teams and oncalls (click to expand)
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: team
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .name
blueprint: '"opsGenieTeam"'
properties:
description: .description
url: .links.web
- kind: service
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .name
blueprint: '"opsGenieService"'
properties:
description: .description
url: .links.web
tags: .tags
relations:
ownerTeam: .teamId
- kind: schedule-oncall
selector:
query: 'true'
port:
entity:
mappings:
identifier: .ownerTeam.id
title: .ownerTeam.name
blueprint: '"opsGenieTeam"'
properties:
oncallUsers: .__currentOncalls.onCallRecipients
Final Step: Full Configuration Example
After completing these changes, your configuration should look like this, incorporating blueprints for team
, service
, alert
and incident
:
Full configuration (click to expand)
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: team
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .name
blueprint: '"opsGenieTeam"'
properties:
description: .description
url: .links.web
- kind: service
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .name
blueprint: '"opsGenieService"'
properties:
description: .description
url: .links.web
tags: .tags
relations:
ownerTeam: .teamId
- kind: alert
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .message
blueprint: '"opsGenieAlert"'
properties:
status: .status
acknowledged: .acknowledged
responders: .responders
priority: .priority
sourceName: .source
tags: .tags
count: .count
createdBy: .owner
createdAt: .createdAt
updatedAt: .updatedAt
description: .description
integration: .integration.name
relations:
relatedIncident: 'if (.alias | contains("_")) then (.alias | split("_")[0]) else null end'
- kind: incident
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .message
blueprint: '"opsGenieIncident"'
properties:
status: .status
responders: .responders
priority: .priority
tags: .tags
url: .links.web
createdAt: .createdAt
updatedAt: .updatedAt
description: .description
relations:
services: .impactedServices
- kind: schedule-oncall
selector:
query: 'true'
port:
entity:
mappings:
identifier: .ownerTeam.id
title: .ownerTeam.name
blueprint: '"opsGenieTeam"'
properties:
oncallUsers: .__currentOncalls.onCallRecipients
Following this guide will ensure your integration is up-to-date and optimized for performance with version 0.2.0. For any issues during the migration, refer to the newly introduced debug logs to identify and contact your support personnel to resolve problems efficiently.