Dynatrace data source for Grafana

The Dynatrace data source plugin allows you to query and visualize Dynatrace metrics from within Grafana.

Requirements

The Dynatrace data source has the following requirements:

Known limitations

  • Template variables cannot be multi-select; only single selection is supported.
  • Only v2 metric APIs are supported.

Install the Dynatrace data source plugin

To install the data source, refer to Installation.

Get an API key from Dynatrace

To set up an API token, refer to Dynatrace API - Tokens and authentication.

Set the metrics.read and entities.read permissions for your API token.

Configure the data source in Grafana

Add a data source by filling in the following fields:

Name
A name for this particular Dynatrace data source.
Dynatrace API Type
Select SaaS or Managed Cluster depending on the instance type you are connecting to.
Environment ID
The first portion of the URL after logging in. e.g. yfc55578.live.dynatrace.com, your environment ID would be yfc55578.
Dynatrace API token
An API token generated with metrics.read and entities.read permissions. Refer to Get an API key and application key from Dynatrace.

Configure the data source with provisioning

It is possible to configure data sources using config files with Grafana’s provisioning system. To read more about how configuration works, including all the settings that you can set for data sources, refer to Provisioning Grafana.

apiVersion: 1
datasources:
  - name: Dynatrace
    type: grafana-dynatrace-datasource
    access: proxy
    editable: true
    enabled: true
    jsonData:
      apiType: saas
      environmentId: environment Id
    secureJsonData:
      apiToken: API token
    version: 1

Query the data source

The query editor allows you to query Dynatrace metrics and problems.

Query

The query type can be Metric or Problems.

Metric query type

Metric
Select the metric that you want to see. To get the metric list from Dynatrace again, click the Refresh button.
Aggregations
Select the aggregation you want to use for a specific metric. Click the aggregations value to change the aggregation type or click the + button to add another aggregation.
Transformations
You can select transformations in the query editor. Afterwards, enter a number of parameters into the selected transformation. Currently, only the merge transformation is supported. For information about the merge transforms, refer to Merge transformation.
Filters
The Dynatrace plugin dynamically queries the appropriate filters for each metric.
To add a filter, click the + symbol next to the Filters label on the Dynatrace query editor, select which field you would like to filter on, select the operator you would like to use, and then select a value to filter by.
The Dynatrace plugin allows you to create Filter Groups that you can join together to create complex logical comparisons. For most use cases, Filter Groups are not required.
When creating filters with Tags, regardless of the conjunction selected, Dynatrace will always use AND. Dynatrace does not support OR filters with Tags.
Alias
There are two different types of aliases you will encounter while using the Dynatrace plugin. The first is a static alias. An alias of this type is available on every query that you build, and the name of the alias starts with a lowercase letter. The second is a dynamic alias, which changes based on the metric that you are using in your query, and the name of the alias starts with an uppercase letter.
The Dynatrace plugin supports several different aliases: Metric Names, Aggregation, Display Name, Host, and Description.
NameValue
$namebuiltin:apps.other.keyUserActions.reportedErrorCount.os
$aggregationauto,value
$displayNameReported error count (by key user action, OS) [mobile, custom]

Problems query type

Problem Query Type
Select a problem query type. Currently, only the feed problem query type is supported. For information about the feed problem query type, refer to Problems API - GET feed.
Status Filter
Filter the result problems by the status.
Impact Filter
Filter the result problems by the impact level.
Severity Filter
Filter the result problems by the severity level.
Expand Details
Include related events to the response, if set.

Templates and variables

To add a new Dynatrace query variable, refer to Add a query variable. Use your Dynatrace data source as your data source for the following available queries:

Query type
Select a query type. The query type associate some data with some key or descriptor.
Query typeDescription
Metric namesReturns a list of all metric names
Filter keysReturns a list of all the possible dimensions (e.g. Hostname) that can be used to filter
Filter values for keyReturns a list of filtered values by a key name or a key name template variable
Problem status optionsReturns a list of all problem statuses
Problem impact optionsReturns a list of all problem impacted areas
Problem severity optionsReturns a list of all problem severity types
Regex
(Optional) Filter out any of the returned values from your query with a regular expression

Note: Multi-value and Include All option are currently not supported by the Dynatrace plugin.

After creating a variable, you can find it in the Metric drop-down menu. For more information about variables, refer to Templates and variables.

Import a dashboard for Dynatrace

To import a dashboard, refer to Importing a dashboard. Imported dashboards can be found in Configuration > Data Sources > select your Dynatrace data source > select the Dashboards tab to see available pre-made dashboards.

Get the most out of the plugin