I am looking to get the CPU and memory from a particular container instance...
I can find the container details using
builtin:kubernetes.containers
and filter for the one I need
I ideally want to run
builtin:containers.cpu.usageMilliCores but in order to get the right container I need the container_group_instance value
I am not sure how to find out this information, can anyone assist?
Solved! Go to Solution.
Not sure what you want to get, builtin:containers.cpu.usageMilliCores also accepts container as filter condition. Can you please further explain your need?
BR
Hey thanks for the response...... we have multiple containers with the same name as they are in different environments.....
So I am using this query
Hi@stephenje you can tag the container on creation to be able to identify it.
Hi, if you want to filter only a single container of a specific namespace you can leverage on relationships like this:
builtin:containers.cpu.usageMilliCores
:filter(in("dt.entity.container_group_instance", entitySelector("type(~"CONTAINER_GROUP_INSTANCE~"),fromRelationships.isCgiOfNamespace(type(CLOUD_APPLICATION_NAMESPACE),entityName.equals(<NAMESPACE_NAME>))")))
:splitBy():sort(value(auto,descending)):limit(20)
or by referencing the namespace by id
builtin:containers.cpu.usageMilliCores
:filter(in("dt.entity.container_group_instance", entitySelector("type(~"CONTAINER_GROUP_INSTANCE~"),fromRelationships.isCgiOfNamespace(type(CLOUD_APPLICATION_NAMESPACE),entityId(<NAMESPACE_entityId>))")))
:splitBy():sort(value(auto,descending)):limit(20)
In general usage of relationships when dealing with k8s entities is very useful.
See:
Monitored entities API - GET all entity types | Dynatrace Docs
Environment API v2 - Entity selector | Dynatrace Docs
Hope this helps
Paolo
Yes, you can reference it by using, type("CONTAINER_GROUP_INSTANCE~"),tag("[context]key1:value-1","key2:value-2","value-3")