CPU
The CPU collector is used to collect the CPU utilization rate of the system.
Configuration¶
Collector Configuration¶
After successfully installing and starting DataKit, the CPU collector will be enabled by default without the need for manual activation.
Go to the conf.d/samples directory under the DataKit installation directory, copy cpu.conf.sample and name it cpu.conf. Examples are as follows:
[[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"
After configuration, restart DataKit.
Can be turned on by ConfigMap Injection Collector Configuration or Config ENV_DATAKIT_INPUTS .
Can also be turned on by environment variables, (needs to be added as the default collector in ENV_DEFAULT_ENABLED_INPUTS):
-
ENV_INPUT_CPU_INTERVAL
Collect interval
Type: Duration
input.conf:
intervalDefault:
10s -
ENV_INPUT_CPU_PERCPU
Collect CPU usage per core
Type: Boolean
input.conf:
percpuDefault: false
-
ENV_INPUT_CPU_ENABLE_TEMPERATURE
Enable to collect core temperature data
Type: Boolean
input.conf:
enable_temperatureDefault:
true -
ENV_INPUT_CPU_ENABLE_LOAD5S
Enable gets average load information every five seconds
Type: Boolean
input.conf:
enable_load5sDefault:
false -
ENV_INPUT_CPU_TAGS
Customize tags. If there is a tag with the same name in the configuration file, it will be overwritten
Type: String
input.conf:
tagsExample:
tag1=value1,tag2=value2
Metric¶
For all of the following data collections, a global tag named host is appended by default (the tag value is the host name of the DataKit), or other tags can be specified in the configuration through [inputs.cpu.tags]:
cpu¶
| Tags & Fields | Description |
|---|---|
| cpu ( tag) |
CPU core ID. For cpu-total, it means all-CPUs-in-one-tag. If you want every CPU's metric, please enable percpu option in cpu.conf or set ENV_INPUT_CPU_PERCPU under K8s |
| host ( tag) |
System hostname. |
| core_temperature | CPU core temperature. This is collected by default. Only collect the average temperature of all cores. Type: float | (gauge) Unit: temperature,C |
| load5s | CPU average load in 5 seconds. Type: int | (gauge) Unit: - |
| usage_guest | % CPU spent running a virtual CPU for guest operating systems. Linux only Type: float | (gauge) Unit: percent,percent |
| usage_guest_nice | % CPU spent running a nice guest(virtual CPU for guest operating systems). Linux only(>=3.2.0) Type: float | (gauge) Unit: percent,percent |
| usage_idle | % CPU in the idle task. Type: float | (gauge) Unit: percent,percent |
| usage_iowait | % CPU waiting for I/O to complete. Linux only Type: float | (gauge) Unit: percent,percent |
| usage_irq | % CPU servicing hardware interrupts. Type: float | (gauge) Unit: percent,percent |
| usage_nice | % CPU in user mode with low priority (nice). Linux only Type: float | (gauge) Unit: percent,percent |
| usage_softirq | % CPU servicing soft interrupts. Linux only Type: float | (gauge) Unit: percent,percent |
| usage_steal | % CPU spent in other operating systems when running in a virtualized environment. Linux only Type: float | (gauge) Unit: percent,percent |
| usage_system | % CPU in system mode. Type: float | (gauge) Unit: percent,percent |
| usage_total | % CPU in total active usage, as well as (100 - usage_idle). Type: float | (gauge) Unit: percent,percent |
| usage_user | % CPU in user mode. Type: float | (gauge) Unit: percent,percent |