Prometheus - Convert cpu_user_seconds to CPU Usage %?

前端 未结 3 1323
一生所求
一生所求 2020-12-29 03:42

I\'m monitoring docker containers via Prometheus.io. My problem is that I\'m just getting cpu_user_seconds_total or cpu_system_seconds_total.

<
相关标签:
3条回答
  • 2020-12-29 04:15

    For Windows Users - wmi_exporter

    100 - (avg by (instance) (irate(wmi_cpu_time_total{mode="idle"}[2m])) * 100)
    
    0 讨论(0)
  • 2020-12-29 04:22

    Rate returns a per second value, so multiplying by 100 will give a percentage:

    rate(container_cpu_user_seconds_total[30s]) * 100

    0 讨论(0)
  • 2020-12-29 04:27

    I also found this way to get CPU Usage to be accurate:

    100 - (avg by (instance) (irate(node_cpu_seconds_total{job="node",mode="idle"}[5m])) * 100)
    

    From: http://www.robustperception.io/understanding-machine-cpu-usage/

    0 讨论(0)
提交回复
热议问题