My host group (or my namespaces in k8S env) contains app_env information and I use them to create 2 distinguished tags “app:xxx” and “env:xxx” on hosts, process and services side.
Afterward, I create management zones and I use an entity selector as condition to add databases automatically based on origin calls service tags values like below :
**type(SERVICE),databaseName.exists(),toRelationships.calls(type(SERVICE),tag(“env:prod”,“app:app”))**It almost works ! The problem is the logical condition between tags is a OR condition as indicated here :Environment API v2 - Entity selector — Dynatrace Docs"An entity with any of the specified tags is included to the response."I could use only one tag env:app-prod on my services, process, and host but I want to know if you have other ideas.Thank you.
Regards.
Hi Aurelien,
You can try to use this kind of MetricSelector expression based on HostGroup instead of tag (restrictive indeed) :
Case 1 : several host group type(service),databaseName.exists(),toRelationships.calls(
type(service),fromRelationships.runsOnHost(
type(host),fromRelationships.isInstanceOf(type(HOST_GROUP),entityName.in(“env1, env2, …”)
Case 2 : one host group entityName.contains(“env1”)
Why make your life difficult?
Can you test it ?
I hope it helps.
Thanks
For Kubernete try this : type(service),databaseName.exists(),toRelationships.calls(type(~“SERVICE~”),fromRelationship.runsOn(type(PROCESS_GROUP),toRelationship.isNamespaceOfPg(type(~“CLOUD_APPLICATION_NAMESPACE~”),entityName.contains(~“app1-prod~”))))
My MetricExpression : builtin:service.requestCount.server:filter(and(or(in(“dt.entity.service”,entitySelector(“type(service),toRelationships.calls(type(~“SERVICE~”),fromRelationship.runsOn(type(PROCESS_GROUP),toRelationship.isNamespaceOfPg(type(~“CLOUD_APPLICATION_NAMESPACE~”),entityName.contains(~“online~”))))”))))):splitBy(“dt.entity.service”):sort(value(auto,descending)):limit(20)
Sure, that works for any entitySelector. All provided criteria (separated by comma) must be fullfilled (AND logic), while when providing more that one value in the same criteria (if the criteria accepts this), OR logic is applied.