跳转至

Disk



磁盘采集器用于主机磁盘信息采集,如磁盘存储空间、Inode 使用情况等。

配置

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

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

[[inputs.disk]]
  ##(optional) collect interval, default is 10 seconds
  interval = '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

  ## Deprecated
  # ignore_mount_points = ["/"]

  ## Deprecated
  # mount_points = ["/"]

  ## Deprecated
  # ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]

  ## Deprecated
  # fs = ["ext2", "ext3", "ext4", "NTFS"]

  ## 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"]

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

配置好后,重启 DataKit 即可。

支持以环境变量的方式修改配置参数:

环境变量名 对应的配置参数项 参数示例
ENV_INPUT_DISK_EXCLUDE_DEVICE exclude_device "/dev/loop0","/dev/loop1" 以英文逗号隔开
ENV_INPUT_DISK_EXTRA_DEVICE extra_device "/nfsdata" 以英文逗号隔开
ENV_INPUT_DISK_TAGS tags tag1=value1,tag2=value2 如果配置文件中有同名 tag,会覆盖它
ENV_INPUT_DISK_ONLY_PHYSICAL_DEVICE only_physical_device 忽略非物理磁盘(如网盘、NFS 等,只采集本机硬盘/CD ROM/USB 磁盘等)任意给一个字符串值即可
ENV_INPUT_DISK_INTERVAL interval 10s

指标

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

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

disk

  • 标签
Tag Description
device Disk device name. (on /dev/mapper return symbolic link, like readlink /dev/mapper/* result)
fstype File system name.
host System hostname.
mount_point Mount point.
  • 指标列表
Metric Description Type Unit
free Free disk size in bytes. int B
inodes_free Free Inode(DEPRECATED: use inodes_free_mb instead). int count
inodes_free_mb Free Inode(need to multiply by 10^6). int count
inodes_total Total Inode(DEPRECATED: use inodes_total_mb instead). int count
inodes_total_mb Total Inode(need to multiply by 10^6). int count
inodes_used Used Inode(DEPRECATED: use inodes_used_mb instead). int count
inodes_used_mb Used Inode(need to multiply by 10^6). int count
inodes_used_percent Inode used percent float percent
total Total disk size in bytes. int B
used Used disk size in bytes. int B
used_percent Used disk size in percent. float percent

文档评价

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