跳转至

CPU


CPU 采集器用于系统 CPU 使用率等指标的采集。

配置

采集器配置

成功安装 DataKit 并启动后,会默认开启 CPU 采集器,无需手动开启。

进入 DataKit 安装目录下的 conf.d/samples 目录,复制 cpu.conf.sample 并命名为 cpu.conf。示例如下:

[[inputs.cpu]]
  ## Collect interval, default is 10 seconds. (optional)
  interval = '10s'

  ## Collect CPU usage per core, default is false. (optional)
  percpu = false

  ## Setting disable_temperature_collect to false will collect cpu temperature stats for linux. (deprecated)
  # disable_temperature_collect = false

  ## Enable to collect core temperature data.
  enable_temperature = true

  ## Enable gets average load information every five seconds.
  enable_load5s = true

[inputs.cpu.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"

配置好后,重启 DataKit 即可。

可通过 ConfigMap 方式注入采集器配置配置 ENV_DATAKIT_INPUTS 开启采集器。

也支持以环境变量的方式修改配置参数(需要在 ENV_DEFAULT_ENABLED_INPUTS 中加为默认采集器):

  • ENV_INPUT_CPU_INTERVAL

    采集器重复间隔时长

    字段类型: Duration

    采集器配置字段: interval

    默认值: 10s

  • ENV_INPUT_CPU_PERCPU

    采集每一个 CPU 核

    字段类型: Boolean

    采集器配置字段: percpu

    默认值: false

  • ENV_INPUT_CPU_ENABLE_TEMPERATURE

    采集 CPU 温度

    字段类型: Boolean

    采集器配置字段: enable_temperature

    默认值: true

  • ENV_INPUT_CPU_ENABLE_LOAD5S

    每五秒钟获取一次平均负载信息

    字段类型: Boolean

    采集器配置字段: enable_load5s

    默认值: false

  • ENV_INPUT_CPU_TAGS

    自定义标签。如果配置文件有同名标签,将会覆盖它

    字段类型: String

    采集器配置字段: tags

    示例: tag1=value1,tag2=value2


指标

以下所有数据采集,默认会追加名为 host 的全局 tag(tag 值为 DataKit 所在主机名),也可以在配置中通过 [inputs.cpu.tags] 指定其它标签:

 [inputs.cpu.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"
  # ...

cpu

CPU usage, load, and optional core temperature metrics derived from host CPU time deltas and sensor readings.

Tags & Fields Description
cpu
(tag)
CPU identifier. cpu-total is the aggregate across all CPUs; per-core values are emitted only when percpu is enabled.
host
(tag)
System hostname.
core_temperature Average CPU core temperature across detected core temperature sensors, in degrees Celsius. Linux only.
Type: float | (gauge)
Unit: temperature,C
load5s Five-second CPU load estimate as a dimensionless host load value.
Type: int | (gauge)
Unit: N/A
usage_guest Percentage of CPU time spent running virtual CPUs for guest operating systems during the collection interval. Linux only.
Type: float | (gauge)
Unit: percent,percent
usage_guest_nice Percentage of CPU time spent running low-priority virtual CPUs for guest operating systems during the collection interval. Linux only, kernel 3.2.0 or later.
Type: float | (gauge)
Unit: percent,percent
usage_idle Percentage of CPU time spent idle during the collection interval.
Type: float | (gauge)
Unit: percent,percent
usage_iowait Percentage of CPU time spent waiting for I/O completion during the collection interval. Linux only.
Type: float | (gauge)
Unit: percent,percent
usage_irq Percentage of CPU time spent servicing hardware interrupts during the collection interval.
Type: float | (gauge)
Unit: percent,percent
usage_nice Percentage of CPU time spent running low-priority nice user processes during the collection interval. Linux only.
Type: float | (gauge)
Unit: percent,percent
usage_softirq Percentage of CPU time spent servicing software interrupts during the collection interval. Linux only.
Type: float | (gauge)
Unit: percent,percent
usage_steal Percentage of CPU time stolen by other operating systems when running in a virtualized environment. Linux only.
Type: float | (gauge)
Unit: percent,percent
usage_system Percentage of CPU time spent in system mode during the collection interval.
Type: float | (gauge)
Unit: percent,percent
usage_total Total active CPU usage percentage during the collection interval, computed from user, system, nice, iowait, irq, softirq, steal, guest, and guest_nice time.
Type: float | (gauge)
Unit: percent,percent
usage_user Percentage of CPU time spent in user mode during the collection interval.
Type: float | (gauge)
Unit: percent,percent

文档评价

文档内容是否对您有帮助? ×