gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
I have a prometheus and i would like a query to total of cpu and limits usage
- User
I have a prometheus and i would like a query to total of cpu and limits usage
- Assistant
To get the total CPU usage and limits in Prometheus, you can use the following query:
sum by (pod) (container_cpu_usage_seconds_total) / ignoring(pod) group_left sum by (pod) (kube_pod_container_resource_limits_cpu_cores)This query uses the
sumfunction to calculate the total CPU usage (container_cpu_usage_seconds_total) and divides it by the total CPU limits (kube_pod_container_resource_limits_cpu_cores). Thesum by (pod)clause groups the data by pod, and theignoring(pod) group_leftclause ensures that the division is performed correctly.Make sure you replace
container_cpu_usage_seconds_totalandkube_pod_container_resource_limits_cpu_coreswith the actual metric names in your Prometheus configuration.