本文介绍了Prometheus-将cpu_user_seconds转换为CPU使用率%?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在通过Prometheus.io监视Docker容器.我的问题是我只得到"cpu_user_seconds_total"或"cpu_system_seconds_total".我的问题是如何将这个不断增加的值转换为CPU百分比?

Currently 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". My question is how to convert this ever-increasing value to a CPU percentage?

当前我正在查询:

rate(container_cpu_user_seconds_total[30s])

但是我认为这是不正确的(与顶部相比).

But I don't think that it is quite correct (comparing to top).

如何将cpu_user_seconds_total转换为CPU百分比? (如上图)

How to convert cpu_user_seconds_total to CPU percentage? (Like in top)

推荐答案

Rate返回每秒的值,因此乘以100将得到一个百分比:

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

rate(container_cpu_user_seconds_total[30s]) * 100

这篇关于Prometheus-将cpu_user_seconds转换为CPU使用率%?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 00:28