Dynatrace recently introduced a powerful feature that allows you to apply tags to processes and hosts based on environment variable injection. We’re happy to announce that we’ve further enhanced this functionality. Dynatrace now allows you to automatically derive tags from your Red Hat OpenShift environment. This enables you to automatically organize and filter all monitored OpenShift application components.

Define your OpenShift labels

You can specify OpenShift labels in the Pod object definition of your application or you can update the labels of your OpenShift resources using the command oc label. Dynatrace automatically detects all labels attached to pods at application deployment time. All you have to do is grant sufficient privileges to read these metadata from the OpenShift masters’ REST API:

  1. In your project, create a service account named dynatrace:
    oc create serviceaccount dynatrace
  2. Allow the dynatrace service account to view your project’s metadata via the OpenShift masters’ REST API:
    oc policy add-role-to-user view -z dynatrace
  3. Add the dynatrace service account to your application’s pod deployment.

Your OpenShift labels will be automatically attached as OpenShift tags to all monitored OpenShift processes in your Dynatrace environment (see example below).

Note: As OpenShift is based on Docker and Kubernetes, Dynatrace also detects selected Kubernetes properties which can be used when specifying automated rule-based tags or property-based process group detection rules:

  • Kubernetes base pod name: user-provided name of the pod the container belongs to
  • Kubernetes container: name of the container that runs the process
  • Kubernetes full pod name: full name of the pod the container belongs to
  • Kubernetes namespace: namespace to which the containerized process is assigned to
  • Kubernetes pod UID: unique ID of the related pod

Leverage OpenShift tags in Dynatrace

OpenShift tags are searchable via Dynatrace search. This allows you to easily find and inspect the monitoring results of related processes running in your Red Hat OpenShift environment. You can also leverage OpenShift tags to set up fine-grained alerting profiles. OpenShift tags also integrate perfectly with Dynatrace filters. For example, you can easily filter technologies or problems based on your OpenShift tags, as shown below.

We’re currently working on broadening our support for automatically applied Openshift tags (for example, to also cover your monitored OpenShift hosts). Additionally, Dynatrace will soon be able to retrieve annotations from the OpenShift masters’ REST API, so stay tuned for updates.

Note: This feature requires OneAgent version 1.127 or above.