Disk IO
Diskio collector is used to collect the index of disk flow and time.
Configuration¶
After successfully installing and starting DataKit, the DiskIO collector will be enabled by default without the need for manual activation.
Precondition¶
For some older versions of Windows operating systems, if you encounter an error with DataKit: "The system cannot find the file specified."
Run PowerShell as an administrator and execute:
The DataKit service needs to be restarted after successful execution.
Collector Configuration¶
Go to the conf.d/samples directory under the DataKit installation directory, copy diskio.conf.sample and name it diskio.conf. Examples are as follows:
[[inputs.diskio]]
##(optional) collect interval, default is 10 seconds
interval = '10s'
## By default, gather stats for all devices including
## disk partitions.
## Setting interfaces using regular expressions will collect these expected devices.
# devices = ['''^sda\d*''', '''^sdb\d*''', '''vd.*''']
## If the disk serial number is not required, please uncomment the following line.
# skip_serial_number = true
## On systems which support it, device metadata can be added in the form of
## tags.
## Currently only Linux is supported via udev properties. You can view
## available properties for a device by running:
## 'udevadm info -q property -n /dev/sda'
## Note: Most, but not all, udev properties can be accessed this way. Properties
## that are currently inaccessible include DEVTYPE, DEVNAME, and DEVPATH.
# device_tags = ["ID_FS_TYPE", "ID_FS_USAGE"]
## Using the same metadata source as device_tags,
## you can also customize the name of the device through a template.
## The "name_templates" parameter is a list of templates to try to apply equipment.
## The template can contain variables of the form "$PROPERTY" or "${PROPERTY}".
## The first template that does not contain any variables that do not exist
## for the device is used as the device name label.
## A typical use case for LVM volumes is to obtain VG/LV names,
## not DM-0 names which are almost meaningless.
## In addition, "device" is reserved specifically to indicate the device name.
# name_templates = ["$ID_FS_LABEL","$DM_VG_NAME/$DM_LV_NAME", "$device:$ID_FS_TYPE"]
[inputs.diskio.tags]
# some_tag = "some_value"
# more_tag = "some_other_value"
Once configured, 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_DISKIO_INTERVAL
Collect interval
Type: Duration
input.conf:
intervalDefault: 10s
-
ENV_INPUT_DISKIO_DEVICES
Setting interfaces using regular expressions will collect these expected devices
Type: List
input.conf:
devicesExample:
^sda\d,^sdb\d,vd.* -
ENV_INPUT_DISKIO_DEVICE_TAGS
Device metadata added tags
Type: List
input.conf:
device_tagsExample: ID_FS_TYPE,ID_FS_USAGE
-
ENV_INPUT_DISKIO_NAME_TEMPLATES
Using the same metadata source as device_tags
Type: List
input.conf:
name_templatesExample: $ID_FS_LABEL,$DM_VG_NAME/$DM_LV_NAME
-
ENV_INPUT_DISKIO_SKIP_SERIAL_NUMBER
disk serial number is not required
Type: Boolean
input.conf:
skip_serial_numberDefault: false
-
ENV_INPUT_DISKIO_TAGS
Customize tags. If there is a tag with the same name in the configuration file, it will be overwritten
Type: Map
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 it can be named by [[inputs.diskio.tags]] alternative host in the configuration.
diskio¶
| Tags & Fields | Description |
|---|---|
| host ( tag) |
System hostname. |
| name ( tag) |
Device name. |
| await | Average time for I/O requests to be served (ms). Linux only Type: float | (gauge) Unit: time,ms |
| io_time | Time spent doing I/Os. Linux only Type: int | (gauge) Unit: time,ms |
| iops_in_progress | I/Os currently in progress. Linux only Type: int | (gauge) Unit: count |
| merged_reads | The number of merged read requests. Linux only Type: int | (gauge) Unit: count |
| merged_writes | The number of merged write requests. Linux only Type: int | (gauge) Unit: count |
| read_bytes | The number of bytes read from the device. Type: int | (gauge) Unit: digital,B |
| read_bytes/sec | The number of bytes read on the device per second. Type: int | (gauge) Unit: traffic,B/S |
| read_time | Time spent reading. Type: int | (gauge) Unit: time,ms |
| reads | The number of read requests. Type: int | (gauge) Unit: count |
| weighted_io_time | Weighted time spent doing I/Os. Linux only Type: int | (gauge) Unit: time,ms |
| write_bytes | The number of bytes written to the device. Type: int | (gauge) Unit: digital,B |
| write_bytes/sec | The number of bytes written to the device per second. Type: int | (gauge) Unit: traffic,B/S |
| write_time | Time spent writing. Type: int | (gauge) Unit: time,ms |
| writes | The number of write requests. Type: int | (gauge) Unit: count |
FAQ¶
What is the data source on Linux hosts¶
On Linux hosts, the metrics are parsed and calculated from the /proc/diskstats file; an explanation of each column can be found in docs;
The corresponding relationship between some data source columns and indicators is as follows:
| Fields | diskio metrics |
|---|---|
| col04: reads completed successfully | reads |
| col05: reads merged | merged_reads |
| col06: sectors read | read_bytes = col06 * sector_size; read_bytes/sec = (read_bytes - last(read_bytes))/(time - last(time)) |
| col07: time spent reading (ms) | read_time |
| col08: writes completed | writes |
| col09: writes merged | merged_writes |
| col10: sectors written | write_bytes = col10 * sector_size; write_bytes/sec = (write_bytes - last(write_bytes))/(time - last(time)) |
| col11: time spent writing (ms) | write_time |
| col12: I/Os currently in progress | iops_in_progress |
| col13: time spent doing I/Os (ms) | io_time |
| col14: weighted time spent doing I/Os (ms) | weighted_io_time |
Attention:
sector_sizeis 512 bytes.- All are count but
read_bytes/secandwrite_bytes/sec.