[TP] Lab - Creating and using Entity Selectors
What you will learn in this TP :
- Validate access to the Dynatrace cluster
- Generate an API Token with the correct rights
- Understand the overall structure of an Entity Selector
- Master basic selection criteria
- Write a complex Entity Selector
- Know how to target specific entities with tags
- Test an Entity Selector query via the REST API v2
- Dynamically validate the result returned by Dynatrace
- Create a Management Zone in the Dynatrace console
- Apply an Entity Selector type rule to a management zone
Prerequisites
What you will learn in this section :You must have a Dynatrace cluster (SaaS or Managed) with agents deployed, as well as an Access Token (API Token) with entity read rights (`entities.read`).
- Validate access to the Dynatrace cluster
- Generate an API Token with the correct rights
Review of Syntax and Key Operators
What you will learn in this section :An Entity Selector is a string used to filter Dynatrace entities. It consists of selection criteria separated by commas (which act as a logical AND operator).
- Understand the overall structure of an Entity Selector
- Master basic selection criteria
Tip: You can use the NOT operator to exclude entities, for example type("HOST"),not(tag("ENV:DEV")).
-
Main criteria
Here are the most used operators to target your entities:- type(): Filter by entity type (e.g., HOST, SERVICE, APPLICATION).
- tag(): Filter by tag. Accepts the key:value format (e.g.,
tag("ENV:PROD")). - entityName(): Filter by entity name, very useful with wildcards like
*.
Creating an Entity Selector
What you will learn in this section :The goal is to isolate a subset of your infrastructure. You must write an 'entity selector' to target only machines (HOST) that have the tag 'ENV=PROD'.
- Write a complex Entity Selector
- Know how to target specific entities with tags
Golden rule of design (Scaling): For each selection rule, you must imperatively define either an Entity ID (unique identifier of the entity) or an Entity type.
Best practice: The use of fixed Entity IDs is to be avoided in production as it is too specific and rigid. To ensure large-scale management compatible with the dynamic lifecycle of your infrastructures, exclusively use the Entity type combined with dynamic attributes or tags.
-
Selector syntax
Write the query to select these entities.
Validation via API
What you will learn in this section :Before applying a rule in a Management Zone, it is highly recommended to test it. You must use the Dynatrace API (v2) to check which entities are returned by your selector.
- Test an Entity Selector query via the REST API v2
- Dynamically validate the result returned by Dynatrace
Tip: URL encoding of your Entity Selector is essential in your cURL requests. For example, quotes"become%22.
-
API Request
Find the cURL command to query the '/api/v2/entities' endpoint with your 'entity selector'.
Creating the Management Zone
What you will learn in this section :Now that your 'entity selector' is validated, you must use it to create a new management zone named 'PROD_ZONE'.
- Create a Management Zone in the Dynatrace console
- Apply an Entity Selector type rule to a management zone
-
Configuration in the console
Indicate the steps to create the Management Zone based on this selector in the Dynatrace interface.
Recommended Articles
Understand the evolution of billing in Dynatrace: the difference between the ...
Discover why and how to configure Grafana Alloy so that it monitors itself, c...
Discover how to enable, secure, and use Grafana Alloy's built-in web interfac...
Discover the fundamental concepts of Grafana Alloy, the transition from the s...
As part of a Grafana training or observability training, master the declarati...
Learn how to configure Grafana Alloy to collect, transform, and forward metri...
Discover how to configure Grafana Alloy to read log files, journald, or netwo...
Dive into distributed trace processing. Learn how to ingest OTLP, Jaeger, or ...
Discover how to configure continuous profiling in your environments using Gra...
Learn how to manage large-scale Grafana Alloy deployments. Configure Clusteri...
Discover Grafana Assistant, the artificial intelligence integrated into Grafa...
Comparison between Grafana Alloy and Dynatrace ActiveGate. Understand the fun...
Course Glossary
The use of artificial intelligence and machine learning to automate and improve IT operations (e.g., anomaly detection, reducing alert noise).
An open source framework providing standards, APIs, and SDKs to collect and export observability data (traces, metrics, logs) in an agnostic way.