Hello,
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 :
Solved! Go to Solution.
22 Mar 2023
01:23 AM
- last edited on
23 Mar 2023
12:40 AM
by
MaciejNeumann
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
Hello @uros_djukic1
It's brilliant thank you, it works great :
type(service),databaseName.exists(),toRelationships.calls(type(service),fromRelationships.runsOnHost(type(host),fromRelationships.isInstanceOf(type(HOST_GROUP),entityName.contains("app1-prod"))))
Do you have an equivalent for kubernetes based on kubernetes namespace value ?
Because, I can do it with the entity selector below but only egal and exist are available (I would like contains) :
type(service),databaseName.exists(),toRelationships.calls(type(service),fromRelationships.runsOn(type(process_group),metadata("KUBERNETES_NAMESPACE:gp-sales-app1-prod")))
https://www.dynatrace.com/support/help/shortlink/api-entities-v2-selector#attribute
Thank you very much
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)
Result :
You rock @uros_djukic1 ! It's perfect for my need, thank you very much.