Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

I have a prometheus and i would like a query to total of cpu and limits usage

  1. User

    I have a prometheus and i would like a query to total of cpu and limits usage

  2. 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 sum function 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). The sum by (pod) clause groups the data by pod, and the ignoring(pod) group_left clause ensures that the division is performed correctly.

    Make sure you replace container_cpu_usage_seconds_total and kube_pod_container_resource_limits_cpu_cores with the actual metric names in your Prometheus configuration.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.