gpt4 book ai didi

docker - 在Grafana中查看Docker CPU的使用情况-是吗?

转载 作者:行者123 更新时间:2023-12-02 19:30:31 25 4
gpt4 key购买 nike

根据Docker Docs,ciff被报告为吉普赛:

For each container, a pseudo-file cpuacct.stat contains the CPU usage accumulated by the processes of the container, broken down into user and system time. The distinction is:

  • user time is the amount of time a process has direct control of the CPU, executing process code.
  • system time is the time the kernel is executing system calls on behalf of the process.

Those times are expressed in ticks of 1/100th of a second, also called “user jiffies”. There are USER_HZ “jiffies” per second, and on x86 systems, USER_HZ is 100. Historically, this mapped exactly to the number of scheduler “ticks” per second, but higher frequency scheduling and tickless kernels have made the number of ticks irrelevant.



但是,我似乎无法弄清楚如何在grafana中将其显示为某种“容器cpu使用率”,因为每个指标都在100ks以内。有什么建议么?

最佳答案

数学:

  • 计算每秒的变化=每秒的速率(仅当您在TSDB中具有原始jiffy值时)
  • 将结果乘以100

  • 结果将是%CPU使用率。

    默认情况下,您无法在Grafana中进行这种数学运算。这是TSDB的一项任务,Grafana只会可视化从TSDB返回的计算结果。

    InfluxDB(TSDB)的(未经测试)示例:
    SELECT 
    DERIVATIVE("jiffy_value_field",1s)*100
    FROM <measurement>
    WHERE ...

    关于docker - 在Grafana中查看Docker CPU的使用情况-是吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51680358/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com