Monitor Dynatrace classic SLOs in Catalog with the Konnect API

TL;DR

Install the Dynatrace integration in Konnect and authorize access with your Dynatrace URL and personal access token (with slo.read permissions), then link an SLO to your Catalog service.

Prerequisites

If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.

  1. The following Konnect items are required to complete this tutorial:
    • Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
  2. Set the personal access token as an environment variable:

    export KONNECT_TOKEN='YOUR KONNECT TOKEN'
    

You need the Integration Admin role in Konnect to install and authorize Catalog integrations.

You need to configure the following in Dynatrace SaaS:

Export your Dynatrace URL and personal access token:

export DYNATRACE_URL='YOUR DYNATRACE URL'
export DYNATRACE_PAT='YOUR DYNATRACE PERSONAL ACCESS TOKEN'

Dynatrace ActiveGate isn’t supported.

Configure the Dynatrace integration

Before you can discover SLOs in Catalog, you must configure the Dynatrace integration.

First, install the Dynatrace integration:

 curl -X POST "https://us.api.konghq.com/v1/integration-instances" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "integration_name": "dynatrace",
       "name": "dynatrace",
       "display_name": "Dynatrace",
       "config": {
         "base_url": "'$DYNATRACE_URL'"
       }
     }'

Export the ID of your Dynatrace integration:

export DYNATRACE_INTEGRATION_ID='YOUR-INTEGRATION-ID'

Next, authorize the Dynatrace integration with your Dynatrace personal access token:

 curl -X POST "https://us.api.konghq.com/v1/integration-instances/$DYNATRACE_INTEGRATION_ID/auth-credential" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "type": "multi_key_auth",
       "config": {
         "headers": [
           {
             "name": "authorization",
             "key": "'$DYNATRACE_PAT'"
           }
         ]
       }
     }'

Once authorized, resources from your Dynatrace account will be discoverable in the UI.

Create a service in Catalog

Create a service that you’ll map to your Dynatrace resources:

 curl -X POST "https://us.api.konghq.com/v1/catalog-services" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "name": "billing",
       "display_name": "Billing Service"
     }'

Export the service ID:

export DYNATRACE_SERVICE_ID='YOUR-SERVICE-ID'

List Dynatrace resources

Before you can map your Dynatrace resources to a service in Catalog, you first need to find the resources that are pulled in from Dynatrace:

 curl -X GET "https://us.api.konghq.com/v1/resources?filter%5Bintegration.name%5D=dynatrace" \
     -H "Authorization: Bearer $KONNECT_TOKEN"

You might need to manually sync your Dynatrace integration for resources to appear. From the Konnect UI by navigating to the Dynatrace integration you just installed and selecting Sync Now from the Actions dropdown menu.

Export the resource ID you want to map to the service:

export DYNATRACE_RESOURCE_ID='YOUR-RESOURCE-ID'

Map resources to a service

Now, you can map the Dynatrace resource to the service:

 curl -X POST "https://us.api.konghq.com/v1/resource-mappings" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "service": "billing",
       "resource": "'$DYNATRACE_RESOURCE_ID'"
     }'

Validate the mapping

To confirm that the Dynatrace resource is now mapped to the intended service, list the service’s mapped resources:

 curl -X GET "https://us.api.konghq.com/v1/catalog-services/$DYNATRACE_SERVICE_ID/resources" \
     -H "Authorization: Bearer $KONNECT_TOKEN"
Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!