# Dynatrace provider

### Supported versions <a href="#supported-versions" id="supported-versions"></a>

* Dynatrace SaaS or Managed version 1.187 or later
  * Versions < 2.0.0 are compatible with Akamas until version 1.8.0
  * Versions >= 2.0.0 are compatible with Akamas from version 1.9.0

### Supported component types <a href="#supported-component-types" id="supported-component-types"></a>

* Linux
  * Ubuntu-16.04, Rhel-7.6
* JVM
  * java-openjdk-8, java-openjdk-11
  * java-ibm-j9vm-6, java-ibm-j9vm-8, java-eclipse-openj9-11
* Web Application
* Kubernetes and Docker

Refer to [Dynatrace provider metrics mapping](https://docs.akamas.io/akamas-docs/3.1.2/akamas-reference/telemetry-providers/dynatrace-metrics-mapping) to see how component-types metrics are extracted by this provider.

### Prerequisites

* a valid Dynatrace license
* Dynatrace OneAgent installed on the servers where the Dynatrace entities to be monitored are running
* Connectivity between:
  * Akamas server and Dynatrace server over port 443 (if Dynatrace is deployed on-premises)
  * Akamas server and internet (over https) if Dynatrace is managed as a SaaS platform
* URL (+ port if it is not the default one) of your Dynatrace server (SaaS or Managed)
* API token from your Dynatrace server (Saas or Managed) with the rights to "Access problems and event feed, metrics, and topology" - see more details [here](https://docs.akamas.io/akamas-docs/3.1.2/integrating-akamas/integrating-telemetry-providers/dynatrace-provider/install-dynatrace-provider)
* A Dynatrace user belonging to the group "Monitoring viewer", which allows access to the environment in read-only mode, without being able to change settings, download or install OneAgent

## Permissions <a href="#permissions" id="permissions"></a>

The Dynatrace provider needs a Dynatrace API token with the following privileges:

* metrics.read (Read entities)
* entities.read (Read metrics)
* DataExport (Access problem and event feed, metrics, and topology)
* DataImport (Data ingest, e.g.: metrics and events)
* ReadSyntheticData (Read synthetic monitors, locations, and nodes)

To generate an API Token for your Dynatrace installation you can follow [these steps](https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/basics/dynatrace-api-authentication).

## Component configuration

To map metrics collected from Dynatrace to Akamas component, the Dynatrace provider looks up some properties in the components of a system grouped under `dynatrace`.

These properties give you access to different strategies to map Akamas components onto Dynatrace entities:

* Map by id
* Map by name
* Map by tags

### Map by id <a href="#map-by-id" id="map-by-id"></a>

You can map a component to a Dynatrace entity by leveraging the unique id of the entity, which you should put under the `id` property in the component:

{% code lineNumbers="true" %}

```yaml
name: MyComponent
properties:
 dynatrace:
  id: HOST-12345YUAB1
```

{% endcode %}

You can find the id of a Dynatrace entity by looking at the URL of a Dynatrace dashboard relative to the entity. Watch out that the "host" key is valid only for Linux components, other components (e.g. the JVM) require to drill down into the host entities to get the PROCESS\_GROUP\_INSTANCE or PROCESS\_GROUP id

### Map by name <a href="#map-by-name" id="map-by-name"></a>

You can map a component to a Dynatrace entity by leveraging the entity’s display name which you should put under the `name` property in the component definition:

{% code lineNumbers="true" %}

```yaml
name: MyComponent
properties:
 dynatrace:
  name: host-1
```

{% endcode %}

### Map by tags <a href="#map-by-tags" id="map-by-tags"></a>

You can map a component to a Dynatrace entity by leveraging Dynatrace tags that match the entity, tags which you should put under the `tags` property in the component definition. If multiple tags are specified all instances matching any of the specified tags will be selected.

{% code lineNumbers="true" %}

```yaml
name: MyComponent
properties:
 dynatrace:
  tags:
     environment: test
     [AWS]dynatrace-monitored: true
```

{% endcode %}

In the case of a key-only tag, the example above would be:

{% code lineNumbers="true" %}

```yaml
name: MyComponent
properties:
 dynatrace:
  tags:
     environment: test
     myKeyOnlyTag: ""
```

{% endcode %}

### Improve component mapping with type <a href="#improve-component-mapping-with-type" id="improve-component-mapping-with-type"></a>

You can improve the matching of components with Dynatrace by adding a `type` property in the component definition, this property will help the Provider match only those Dynatrace entities of the given type.

{% code lineNumbers="true" %}

```yaml
name: MyComponent
properties:
 dynatrace:
  type: service     # here the type helps the mapping by tags by filtering down entities that are only services
  tags:
     environment: test
     "[AWS]dynatrace-monitored": true
```

{% endcode %}

The type of an entity can be retrieved from the URL of the entity’s dashboard

<figure><img src="https://2641073690-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ubiK4vpNilxkD7Fauar%2Fuploads%2FfDU5ctMT7V305FW9O5yJ%2Fimage-20220120-152125.png?alt=media&#x26;token=4dcf48d3-7239-4955-8f6c-08f1c60673fe" alt=""><figcaption></figcaption></figure>

Available entities types can be retrieved, from your Dynatrace instance, with the following command:

```
curl 'https://<Your Dynatrace host>/api/v2/entityTypes/?pageSize=500' --header 'Authorization: Api-Token <API-TOKEN>'
```

## Kubernetes specific properties <a href="#kubernetes-specific-properties" id="kubernetes-specific-properties"></a>

A set of Kubernetes-specific properties can be used to allow users to retrieve data related to the monitored Kubernetes clusters.

Please note, that the property `type` is required to retrieve Kubernetes entities. Currently, the supported types in Dynatrace are the following

| Dynatrace type                | Kubernetes type  |
| ----------------------------- | ---------------- |
| CONTAINER\_GROUP\_INSTANCE    | Docker container |
| CLOUD\_APPLICATION\_INSTANCE  | Pod              |
| CLOUD\_APPLICATION            | Workload         |
| CLOUD\_APPLICATION\_NAMESPACE | Namespace        |
| KUBERNETES\_CLUSTER           | Cluster          |

The following Kubernetes object can be retrieved from Dynatrace.

### Container <a href="#container" id="container"></a>

The following properties are supported for containers:

| Akamas        | Dynatrace                 | Location            | Notes |
| ------------- | ------------------------- | ------------------- | ----- |
| namespace     | Kubernetes namespace      | Container dashboard | -     |
| containerName | Kubernetes container name | Container dashboard | -     |
| basePodName   | Kubernetes base pod name  | Container dashboard | -     |

#### Example <a href="#example" id="example"></a>

<figure><img src="https://2641073690-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ubiK4vpNilxkD7Fauar%2Fuploads%2FeFMbL7yCWGhosSNPaUbc%2Fe845f4b6-a190-4ddc-9a32-0a974e771ae3.png?alt=media&#x26;token=0e8a1654-1274-43cb-a7bb-680ff7e8d9ae" alt=""><figcaption></figcaption></figure>

{% code lineNumbers="true" %}

```yaml
dynatrace:
  type: CONTAINER_GROUP_INSTANCE
  kubernetes:
    namespace: boutique
    containerName: server
    basePodName: ak-frontend-*
```

{% endcode %}

### Pod <a href="#pod" id="pod"></a>

The following properties are supported for pods

| Akamas | Dynatrace | Location      | Notes                                                                                                                                                       |
| ------ | --------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| state  | State     | Pod dashboard | -                                                                                                                                                           |
| labels | Labels    | Pod dashboard | <p>Labels are specified as key-value in Akamas configuration.</p><p>In Dynatrace’s dashboard key and value are separated with a column (<code>:</code>)</p> |

#### Example <a href="#example.1" id="example.1"></a>

<figure><img src="https://2641073690-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ubiK4vpNilxkD7Fauar%2Fuploads%2F4uuNmHQfSyx4qWstColH%2F60e5ab80-ffa7-405b-a383-2f786631a83b.png?alt=media&#x26;token=b9240ab8-1a9a-4e5f-883e-94ce0f2e4c3d" alt=""><figcaption></figcaption></figure>

{% code lineNumbers="true" %}

```yaml
dynatrace:
  type: CLOUD_APPLICATION_INTSTANCe
  namePrefix: ak-frontend-
  kubernetes:
    state: RUNNING
    labels:
      app: ak-frontend
      product: hipstershop
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.akamas.io/akamas-docs/3.1.2/integrating-akamas/integrating-telemetry-providers/dynatrace-provider.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
