如何获得CPU使用率高于X%的时间百分比?
我有一个查询以获取百分比的CPU使用情况:
avg without (mode,cpu) (
1 - rate(node_cpu_seconds_total{mode="idle", job="openwrt"}[1m])
) *100
我想获得以上CPU使用的时间百分比,例如80%。
因此,例如,如果数据为56.4 32.5 53.5 89.0 67.9 21.2 90.4 25.7 6.7 6.7 92.3
是3/10 = 30%
I have this as a query to get CPU usage in percentage:
avg without (mode,cpu) (
1 - rate(node_cpu_seconds_total{mode="idle", job="openwrt"}[1m])
) *100
I want to get the percentage of time that the CPU usage is above, for example, 80%.
So for example if the data is 56.4 32.5 53.5 89.0 67.9 21.2 90.4 25.7 6.7 92.3
it'll be 3/10 = 30%
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下查询:
此查询返回CPU SAGE在最后一个小时高出80%的时间百分比。它使用 subquery feature 用于计算 avg_over_time 在最后一个小时的每时平均CPU使用率上。
Try the following query:
This query returns the percentage of time when CPU sage was higher than 80% during the last hour. It uses subquery feature for calculating avg_over_time over the per-minute average CPU usage for the last hour.