DiskIO 输入插件
此插件收集磁盘流量和时间的指标。
引入于: Telegraf v0.10.0 标签: system 操作系统支持: all
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Read metrics about disk IO by device
[[inputs.diskio]]
## Devices to collect stats for
## Wildcards are supported except for disk synonyms like '/dev/disk/by-id'.
## ex. devices = ["sda", "sdb", "vd*", "/dev/disk/by-id/nvme-eui.00123deadc0de123"]
# devices = ["*"]
## Skip gathering of the disk's serial numbers.
# skip_serial_number = true
## Device metadata tags to add on systems supporting it (Linux only)
## Use 'udevadm info -q property -n <device>' to get a list of properties.
## 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 via templates.
## The 'name_templates' parameter is a list of templates to try and apply to
## the device. The template may contain variables in the form of '$PROPERTY' or
## '${PROPERTY}'. The first template which does not contain any variables not
## present for the device is used as the device name tag.
## The typical use case is for LVM volumes, to get the VG/LV name instead of
## the near-meaningless DM-0 name.
# name_templates = ["$ID_FS_LABEL","$DM_VG_NAME/$DM_LV_NAME"]Docker 容器
要在容器内监控 Docker 引擎主机,您需要将主机的(host’s)文件系统挂载(mount)到容器中,并将 HOST_PROC 环境变量设置为 /proc 文件系统的位置。此外,还需要使用特权模式(privileged mode)来提供对 /dev 的访问。
如果您正在使用 device_tags 或 name_templates 选项,则需要将 /run/udev 绑定挂载(bind mount)到容器中。
docker run --privileged -v /:/hostfs:ro -v /run/udev:/run/udev:ro -e HOST_PROC=/hostfs/proc telegrafMetrics
- diskio
- 标签 (tags)
- name (设备名称)
- serial (设备序列号)
- 字段 (fields)
- reads (整数, 计数器)
- writes (整数, 计数器)
- read_bytes (整数, 计数器, 字节)
- write_bytes (整数, 计数器, 字节)
- read_time (整数, 计数器, 毫秒)
- write_time (整数, 计数器, 毫秒)
- io_time (整数, 计数器, 毫秒)
- weighted_io_time (整数, 计数器, 毫秒)
- iops_in_progress (整数, 计量器)
- merged_reads (整数, 计数器)
- merged_writes (整数, 计数器)
- io_util (float64, 计量器, 百分比)
- io_await (float64, 计量器, 毫秒)
- io_svctm (float64, 计量器, 毫秒)
- 标签 (tags)
在 Linux 上,这些值对应于 /proc/diskstats 和 /sys/block/<dev>/stat 中的值。
reads & writes
当 I/O 请求完成时,这些值会增加。
read_bytes & write_bytes
这些值计算从该块设备读取或写入的字节数。
read_time & write_time
这些值计算 I/O 请求在此块设备上等待的毫秒数。如果存在多个等待的 I/O 请求,这些值将以大于 1000/秒 的速率增加;例如,如果有 60 个读取请求平均等待 30 毫秒,则 read_time 字段将增加 60*30 = 1800。
io_time
此值计算设备排队 I/O 请求的毫秒数。
weighted_io_time
此值计算 I/O 请求在此块设备上等待的毫秒数。如果存在多个等待的 I/O 请求,此值将作为等待毫秒数乘以等待请求数的乘积来增加(参见上面的 read_time 示例)。
iops_in_progress
此值计算已发出给设备驱动程序但尚未完成的 I/O 请求数。它不包括已在队列中但尚未发出给设备驱动程序的 I/O 请求。
merged_reads & merged_writes
为了提高效率,相邻的读取和写入可能会被合并。因此,两个 4K 读取可能会合并为一个 8K 读取,然后再将其传给磁盘,这样它将被计算(并排队)为一个 I/O。这些字段可以让您了解合并发生的频率。
io_await
每个 I/O 操作的平均时间(毫秒)
io_svctm
每个 I/O 操作的服务时间,不包括等待时间(毫秒)
io_util
磁盘活动时间百分比(%)
示例查询
计算每个磁盘和主机的 IO 利用率百分比
SELECT non_negative_derivative(last("io_time"),1ms) FROM "diskio" WHERE time > now() - 30m GROUP BY "host","name",time(60s)计算平均队列深度
iops_in_progress 会给您一个瞬时值。这将为您提供轮询间隔之间的平均值。
SELECT non_negative_derivative(last("weighted_io_time"),1ms) from "diskio" WHERE time > now() - 30m GROUP BY "host","name",time(60s)示例输出
diskio,name=sda1 merged_reads=0i,reads=2353i,writes=10i,write_bytes=2117632i,write_time=49i,io_time=1271i,weighted_io_time=1350i,read_bytes=31350272i,read_time=1303i,iops_in_progress=0i,merged_writes=0i 1578326400000000000
diskio,name=centos/var_log reads=1063077i,writes=591025i,read_bytes=139325491712i,write_bytes=144233131520i,read_time=650221i,write_time=24368817i,io_time=852490i,weighted_io_time=25037394i,iops_in_progress=1i,merged_reads=0i,merged_writes=0i 1578326400000000000
diskio,name=sda write_time=49i,io_time=1317i,weighted_io_time=1404i,reads=2495i,read_time=1357i,write_bytes=2117632i,iops_in_progress=0i,merged_reads=0i,merged_writes=0i,writes=10i,read_bytes=38956544i 1578326400000000000diskio,name=sda io_await:0.3317307692307692,io_svctm:0.07692307692307693,io_util:0.5329780146568954 1578326400000000000
diskio,name=sda1 io_await:0.3317307692307692,io_svctm:0.07692307692307693,io_util:0.5329780146568954 1578326400000000000
diskio,name=sda2 io_await:0.3317307692307692,io_svctm:0.07692307692307693,io_util:0.5329780146568954 1578326400000000000此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。