Skip to main content

Dynatrace

Dynatrace is a software intelligence platform that monitors and optimizes application performance, development and security, IT infrastructure, and user experience. The Dynatrace Software Intelligence Platform maps, and monitors applications, microservices, container orchestration platforms such as Kubernetes, and IT infrastructure running in multi-cloud and hybrid-cloud environments, and provides automated problem remediation.

Nobl9 integration with Dynatrace allows users to fetch metric datapoints via metric v2 API with a one-minute resolution. Users can provide a custom selector (by providing value for the metricSelector parameter of the API).

caution

Dynatrace's metricSelector allows you to query for multiple metrics at once. Note that Nobl9 treats SLO data points as time series. Effectively, it means that Nobl9 rejects any datapoint with a timestamp already stored for a given SLO.

To avoid uncertainty, query for data points for only one metric.

Scope of Support

Nobl9 integration with Dynatrace supports only metrics obtained via the metricSelector clause. For details, see Metrics API - Get Metric Data Points | Dynatrace Documentation.

Authentication

When setting up the Nobl9 Agent or Direct connection to your Dynatrace instance, you must provide an access token with metrics.read scope enabled. For details on how to get your token, refer to the Dynatrace API - Tokens and authentication | Dynatrace Documentation.

Adding Dynatrace as a Data Source in the UI

To add Dynatrace as a data source in Nobl9 using the Agent or Direct connection method, follow these steps:

  1. Navigate to Integrations > Sources.
  2. Click the button.
  3. Click the relevant Source icon.
  4. Choose a relevant connection method (Agent or Direct), then configure the source as described below.

Dynatrace Direct

Direct Configuration in the UI

Direct connection to Dynatrace requires users to enter their credentials which Nobl9 stores safely. To set up this type of connection:

  1. Add the URL to connect to your data source (mandatory).
    Depending on the type of environment, the URL must match one of the following formats:

    • SaaS: <https://{your-environment-id}.live.dynatrace.com>

    • Managed: <https://{your-domain}/e/{your-environment-id}>

    • Environment ActiveGate: <https://{your-activegate-domain}/e/{your-environment-id}>

  2. Enter the Dynatrace Token (mandatory).
    To use the Dynatrace API, you must provide an access token with metrics.read scope enabled. For more information, refer to the Authentication section above.

  1. Select a Project.
    Specifying a Project is helpful when multiple users are spread across multiple teams or projects. When the Project field is left blank then object is assigned to project default.
  2. Enter a Display Name.
    You can enter a friendly name with spaces in this field.
  3. Enter a Name.
    The name is mandatory and can only contain lowercase, alphanumeric characters and dashes (for example, my-project-name). This field is populated automatically when you enter a display name, but you can edit the result.
  4. Enter a Description.
    Here you can add details such as who is responsible for the integration (team/owner) and the purpose of creating it.
  5. Click the Add Data Source button.

Dynatrace Agent

Agent Configuration in the UI

Follow the instructions below to set up an Agent connection. Refer to the section above for the descriptions of the fields.

  1. Add the URL to connect to your data source.
  1. Enter a Project.
  2. Enter a Display Name.
  3. Enter a Name.
  4. Create a Description.
  5. Click the Add Data Source button.

Agent Using CLI - YAML

The YAML for setting up an Agent connection to Dynatrace looks like this:

apiVersion: n9/v1alpha
kind: Agent
metadata:
name: dynatrace
displayName: Dynatrace Agent # optional
project: dynatrace
spec:
sourceOf:
- Metrics
- Services
dynatrace:
url: https://your-environment-id.live.dynatrace.com

Important Notes

Agent specification from Dynatrace requires one field:

  • spec.dynatrace.urlstring: interface URL

Depending on the environment, the expected URL format is:

  • SaaS: <https://\{your-environment-id}\.live.dynatrace.com>

  • Managed: <https://\{your-domain\}/e/\{your-environment-id\}>

  • Environment ActiveGate: <https://\{your-activegate-domain\}/e/\{your-environment-id\}>

warning

You can deploy only one Agent in one YAML file by using the sloctl apply command.

Deploying Dynatrace Agent

When you add the data source, Nobl9 automatically generates a Kubernetes configuration and a Docker command line for you to use to deploy the Agent. Both of these are available in the web UI, under the Agent Configuration section. Be sure to swap in your credentials (e.g., replace <DYNATRACE_TOKEN> in the following YAML with your Dynatrace access token with metrics.read scope enabled).

If you use Kubernetes, you can apply the supplied YAML config file to a Kubernetes cluster to deploy the Agent. It will look something like this:

# DISCLAIMER: This deployment description contains only the fields necessary for the purpose of this demo.
# It is not a ready-to-apply Kubernetes deployment description, and the client_id and client_secret are only exemplary values.

apiVersion: v1
kind: Secret
metadata:
name: nobl9-agent-nobl9-dev-mydynatrace-b
namespace: default
type: Opaque
stringData:
dynatrace_token: <DYNATRACE_TOKEN>
client_id: "unique_client_id"
client_secret: "unique_client_secret"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nobl9-agent-nobl9-dogfood-default-dynatrace-agent
namespace: default
spec:
replicas: 1
selector:
matchLabels:
nobl9-agent-name: dynatrace-agent
nobl9-agent-project: default
nobl9-agent-organization: nobl9-dogfood
template:
metadata:
labels:
nobl9-agent-name: dynatrace-agent
nobl9-agent-project: default
nobl9-agent-organization: nobl9-dogfood
spec:
containers:
- name: agent-container
image: nobl9/agent:latest
resources:
requests:
memory: "350Mi"
cpu: "0.1"
env:
- name: N9_CLIENT_ID
valueFrom:
secretKeyRef:
key: client_id
name: nobl9-agent-nobl9-dogfood-default-dynatrace-agent
- name: N9_CLIENT_SECRET
valueFrom:
secretKeyRef:
key: client_secret
name: nobl9-agent-nobl9-dogfood-default-dynatrace-agent
- name: DYNATRACE_TOKEN
valueFrom:
secretKeyRef:
key: dynatrace_token
name: nobl9-agent-nobl9-dogfood-default-dynatrace-agent
# The N9_METRICS_PORT is a variable specifying the port to which the /metrics and /health endpoints are exposed.
# The 9090 is the default value and can be changed.
# If you don’t want the metrics to be exposed, comment out or delete the N9_METRICS_PORT variable.
- name: N9_METRICS_PORT
value: "9090"

Creating SLOs with Dynatrace

Creating SLOs in the UI

Follow the instructions below to create your SLOs with Dynatrace in the UI:

  1. Navigate to Service Level Objectives.

  2. Click the button.
  3. In step 1 of the SLO wizard, select the Service the SLO will be associated with.

  4. In step 2, select Dynatrace as the Data Source for your SLO, then specify the Metric. You can choose either a Threshold Metric, where a single time series is evaluated against a threshold, or a Ratio Metric, which allows you to enter two time series to compare (for example, a count of good requests and total requests).

    note

    For the Ratio Metric, you can choose the Data Count Method:

    • For the Non-incremental method, we expect it to be the components of the sum.
    • For the Incremental method, we expect the value of a metric to be the current sum of some numerator.

    For more information, refer to the SLO Calculations Guide.

  5. Enter a Metric Selector, or Metric selector for good counter and Metric selector for total counter for the metric you selected.

    • Metric selector selects metrics for the query by their keys.
    • You can select up to 10 metrics for one query. metricSelector can be obtained from the Dynatrace v2 API. In the Custom chart area, select the Try it out button. Then, in the Data Explorer, select the Code tab.

    For more information and query samples, refer to the SLOs using Dynatrace - YAML samples section below.

  6. In step 3, define a Time Window for the SLO.

  7. In step 4, specify the Error Budget Calculation Method and your Objective(s).

  8. In step 5, add a Name, Description, and other details about your SLO. You can also select Alert Policies and Labels on this screen.

  9. When you’re done, click Create SLO.

SLOs using Dynatrace - YAML samples

Here’s an example of Dynatrace using a rawMetric (Threshold metric):

apiVersion: n9/v1alpha
kind: SLO
metadata:
name: dynatrace-slo-example
project: dynatrace
spec:
service: dynatrace-service
indicator:
metricSource:
name: dynatrace
timeWindows:
- unit: Day
count: 7
isRolling: true
budgetingMethod: Occurrences
objectives:
- displayName: Good
op: lte
rawMetric:
query:
dynatrace:
metricSelector: builtin:synthetic.http.duration.geo:filter(and(in("dt.entity.http_check",entitySelector("type(http_check),entityName(~"API Sample~")")),in("dt.entity.synthetic_location",entitySelector("type(synthetic_location),entityName(~"N. California~")")))):splitBy("dt.entity.http_check","dt.entity.synthetic_location"):avg:auto:sort(value(avg,descending)):limit(20)
value: 150
target: 0.50
- displayName: Moderate
op: lte
rawMetric:
query:
dynatrace:
metricSelector: builtin:synthetic.http.duration.geo:filter(and(in("dt.entity.http_check",entitySelector("type(http_check),entityName(~"API Sample~")")),in("dt.entity.synthetic_location",entitySelector("type(synthetic_location),entityName(~"N. California~")")))):splitBy("dt.entity.http_check","dt.entity.synthetic_location"):avg:auto:sort(value(avg,descending)):limit(20)
value: 200
target: 0.75
- displayName: Annoying
op: lte
rawMetric:
query:
dynatrace:
metricSelector: builtin:synthetic.http.duration.geo:filter(and(in("dt.entity.http_check",entitySelector("type(http_check),entityName(~"API Sample~")")),in("dt.entity.synthetic_location",entitySelector("type(synthetic_location),entityName(~"N. California~")")))):splitBy("dt.entity.http_check","dt.entity.synthetic_location"):avg:auto:sort(value(avg,descending)):limit(20)
value: 300
target: 0.95

Metric specification from Dynatrace requires one field:

  • dynatrace.metricSelector – mandatory, string. You can try out your metricSelector in the Data Explorer tool. In the Custom chart area, click the Try it out button. Then, in the Data Explorer, select the Code tab:
Image 1: Data Explorer tool

Dynatrace metricSelector is a powerful instrument for specifying which metrics you want to read with the GET metric data points. By using metricSelector, you can transform the resulting set of data points. For more details, go to Metrics API - Metric Selector | Dynatrace Documentation.

Querying the Dynatrace Server

Nobl9 calls the Dynatrace server every minute to retrieve the raw data.

Get Metric Data Points | Dynatrace Documentation

Metrics API - Metric Selector | Dynatrace Documentation

Metrics API - Get Metrics | Dynatrace Documentation

Agent Metrics | Nobl9 Documentation

Creating SLOs via Terraform | Nobl9 Terraform Documentation

Creating Agents via Terraform | Nobl9 Terraform Documentation