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¶
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 |