Go to the conf.d/host directory under the DataKit installation directory, copy disk.conf.sample and name it disk.conf. Examples are as follows:
[[inputs.disk]]##(optional) collect interval, default is 10 secondsinterval='10s'## Physical devices only (e.g. hard disks, cd-rom drives, USB keys)## and ignore all others (e.g. memory partitions such as /dev/shm)only_physical_device=false## merge disks that with the same device name(default true)# merge_on_device = true## We collect all devices prefixed with dev by default,If you want to collect additional devices, it's in extra_device add# extra_device = ["/nfsdata"]## exclude some with dev prefix (We collect all devices prefixed with dev by default)# exclude_device = ["/dev/loop0","/dev/loop1"]ignore_fstypes='''^(tmpfs|autofs|binfmt_misc|devpts|fuse.lxcfs|overlay|proc|squashfs|sysfs)$'''ignore_mountpoints='''^(/usr/local/datakit/.*|/run/containerd/.*)$'''#[inputs.disk.tags]# some_tag = "some_value"# more_tag = "some_other_value"
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 by [inputs.disk.tags]:
Under Linux, we first get device and mount info from /proc/self/mountinfo, then get disk usage metrics via statfs() syscall. For Windows, we get device and mount info via Windows APIs like GetLogicalDriveStringsW(), and get disk usage by another API GetDiskFreeSpaceExW()
In the Version-1.66.0 release, the disk collector has been optimized. However, mount points for the same device will still be merged into one, with only the first mount point being taken. If you need to collect all mount points, a specific flag(merge_on_device/ENV_INPUT_DISK_MERGE_ON_DEVICE) must be disable. While this flag disabled, this may result in a significant increase in the number of time series in the disk measurement.