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.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.