03 Nov 2023 04:56 PM
I can grab a bunch of container statistics for CONTAINER_GROUP_INSTANCES easily, but I am trying to get container restarts for a container group instance in a given namespace.
Is there any way to do this? Am I mixing apples and oranges here?
Any advice appreciated.
Lou
Solved! Go to Solution.
03 Nov 2023 05:31 PM
Do you want to perform a reboot or display information about restarts on your environments?
03 Nov 2023 05:59 PM
Display the number of restarts per time interval.
03 Nov 2023 06:19 PM
There is a metric to report the number of container restarts: builtin:kubernetes.container.restarts
03 Nov 2023 09:36 PM
Hi Radek, I cannot get this to pull for a CONTAINER_GROUP_INSTANCE. Is there a trick to this?
I can pull for a Kubernetes Namespace.
All my other CGI stats are being queried by CGI.
Lou
03 Nov 2023 10:18 PM
Hi,
For the builtin:kubernetes.container.restarts metric, you do not have the CONTAINER_GROUP_INSTANCE dimension available. This is a different entityType. It is only present for metrics:
The metric that tells us about pod restarts on Kubernetes is builtin:kubernetes.container.restarts and below you have the dimensions you can use:
Kubernetes workload (dt.entity.cloud_application), Kubernetes pod (dt.entity.cloud_application_instance), Kubernetes namespace (dt.entity.cloud_application_namespace), Kubernetes cluster (dt.entity.kubernetes_cluster), Kubernetes node (dt. entity.kubernetes_node), dt.kubernetes.node.system_uuid, k8s.cluster.name, k8s.container.name, k8s.cronjob.name, k8s.deployment.name, k8s.namespace.name, k8s.node.name, k8s.pod.name, k8s.pod.uid, k8s.workload.kind, k8s.workload.name.
In this case, I would recommend using Kubernetes namespace.
Some docs for you:
https://docs.dynatrace.com/docs/dynatrace-api/environment-api/entity-v2/get-all-entity-types
https://docs.dynatrace.com/docs/dynatrace-api/environment-api/entity-v2/entity-selector
Hope this help.
Radek