Dynatrace data source for Grafana

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

Requirements

This plugin has the following requirements:

  • A Dynatrace account
  • One of the following account types:
    • Grafana Cloud: Pro customers, Advanced customers, or Pro trial users with the Enterprise plugin add-on enabled
    • Grafana Enterprise: Customers with an activated license and a user with Grafana server or organization administration permissions
  • The Enterprise plugin add-on enabled

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
The name you want to apply to the Dynatrace data source.
Dynatrace API Type
The type of Dynatrace instance that you are connecting to. There are 3 options:
  1. SaaS
  2. Managed Cluster
  3. Raw URL
Environment ID
In the SaaS example of yfc55578.live.dynatrace.com, your Environment ID would be yfc55578. In the Managed example of yd8888.managed-sprint.dynalabs.io/e/abc99984-3af2-55tt-72kl-0672983gc45, your Environment ID would be abc99984-3af2-55tt-72kl-0672983gc45, and your Domain would be yd8888.managed-sprint.dynalabs.io

saas-config managed-config

Raw URL
The URL of your custom dynatrace instance. e.g. https://yfc55578.live.dynatrace.com. Raw URL allows the entry of a URL to a dynatrace instance that falls outside of either SaaS or Managed Cluster.

url-config

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.
Skip TLS verify
optional Enable this option if you required to skip TLS verification. Default value: false
With CA Cert
optional Needed for verifying self-signed TLS Certs Default value: false. If enabled, you also need to provide the corresponding certificate in CA Cert section

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
  - name: Dynatrace Managed
    type: grafana-dynatrace-datasource
    access: proxy
    editable: true
    enabled: true
    jsonData:
      apiType: managed
      environmentId: environment Id # example: abc99984-3af2-55tt-72kl-0672983gc45
      domain: domain # example: yd8888.managed-sprint.dynalabs.io
      tlsSkipVerify: false
      tlsAuthWithCACert: true
    secureJsonData:
      apiToken: API token
      tlsCACert: |
        -----BEGIN CERTIFICATE-----
        1221323123213123231231232+g6DAzj/11231
        sdsaas==
        -----END CERTIFICATE-----
    version: 1

Query the data source

The query editor allows you to configure 4 different types of dynatrace queries.

Query

The query type can be Metric, Problems, USQL, Logs, Audit Logs, Management Zones or Direct API Access.

Metric query type

Management Zone (optional)
Select management zone(s) to filter results by management zone.
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]
Limit
Set a Limit to the size of the results. Each series will be limited by this amount.

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.

USQL query type

USQL Query Type
Select the USQL Query type. This query type uses the user sessions API
USQL Query
The toolbar to the left of this area has 3 options
  1. Revert: Will revert your query to the latest saved query
  2. Save: Saves the current query and will execute the query (Alt+S/Cmd+S/Click). The toggle switch to the right is to enable auto-save. In auto-save mode, the query will be saved as soon as you navigate away from the query editor. (ie: Hit the refresh button)
  3. Add Deeplink Fields: When toggled will return deeplinked fields in the query as an additional dataset. Transformations can then be used to further massage the data.

Logs query type

Query
The log search query. The query must use the Dynatrace search query language. Example Query: log.source="/var/log/syslog" AND (loglevel="error" OR loglevel="warn")
Sort
This defines how to sort the results.

Results are filtered based on dashboard timerange automatically.

Refer the underlying API documentation here for more details and limitations.

Note: The Logs query type is in beta. Please report any unexpected behavior to the Grafana Support team. The underlying Dynatrace API is an early adopter release. The API may change in ways that are not compatible with this plugin.

Audit Logs query type

Filter
Filters the audit log. You can enter the filter query as specified in the DynaTrace API Documentation. Example Query: eventType("CREATE","UPDATE"),category("CONFIG")
Sort
This defines how to sort the results.

Results are filtered based on dashboard timerange automatically.

Refer the underlying API documentation here for more details and limitations.

Direct API Access query type

: Direct API Access allows querying any other dynatrace api endpoint, but will require that you parse out the data using JSON Path expression

API Endpoint
Enter the portion of the api endpoint starting with the version. Examples:
API DocumentationAPI Endpoint
Syntheticsv2/synthetic/locations
Eventsv2/events
Parse using JSONPath
This is the default. When selected, the response is returned with column headers as JSON paths, making it simple to parse out individual fields if desired.
Field
Enter the JSON Path of the field to extract in the response
Type
Select the type the data should be extracted as. If using auto, the type will be automatically detected. For numbers that are within one year of the current UNIX Millisecond Epoch, the field will be of type “time”. Note that times that fail to be parsed as a time will be returned with a value of nil.
Alias
Select the Alias. When entered, the column header/name will reflect the alias entered. Currently, template variables are not supported. Leave blank to use the default, which is the JSON path.
Plus
At the far right of a field line entry, clicking the plus sign will add an additional field.

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
Query EditorAllows you to configure a customer query using the query editor for which you can use
to create a custom template variable. The query must return only 1 column.
When your query is returning 1 column, hit the Apply button.
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