使用 Prometheus 找出重新启动的容器的名称

Find out name of container that restarted, using Prometheus

目前我正在使用以下查询

sum(rate(kube_pod_container_status_restarts_total{namespace="default"}[5m]))

当 1 个或多个容器在默认命名空间中重新启动时收到警报。

这给了我重新启动的容器数量,但没有它们的名称。有没有办法获取重新启动的容器的名称?

谢谢。

试试下面的查询

sum (changes (kube_pod_container_status_restarts_total[1m])) by (container,container_name,endpoint,instance,job,name,namespace, pod, pod_name,service)