磁盘输入插件
此插件收集磁盘使用情况的指标。
used_percent 字段是通过 used / (used + free) 计算得出的,而不是像 Unix df 命令那样使用 used / total。有关更多详细信息,请参阅 Wikipedia - df。
引入于: Telegraf v0.1.1 标签: system 操作系统支持: all
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Read metrics about disk usage by mount point
[[inputs.disk]]
## By default stats will be gathered for all mount points.
## Set mount_points will restrict the stats to only the specified mount points.
# mount_points = ["/"]
## Ignore mount points by filesystem type.
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
## Ignore mount points by mount options.
## The 'mount' command reports options of all mounts in parathesis.
## Bind mounts can be ignored with the special 'bind' option.
# ignore_mount_opts = []Docker 容器
要在容器内监控 Docker 引擎主机,您需要将主机的 filesystem 挂载到容器中,并将 HOST_PROC 环境变量设置为 /proc 文件系统的位置。如果需要,您还可以设置 HOST_MOUNT_PREFIX 环境变量为包含 /proc 目录的前缀,当存在此变量时,它将从报告的 path 标签中剥离。
docker run -v /:/hostfs:ro -e HOST_MOUNT_PREFIX=/hostfs -e HOST_PROC=/hostfs/proc telegrafMetrics
- disk
- 标签 (tags)
- fstype (文件系统类型)
- device (设备文件)
- path (挂载点路径)
- mode (挂载模式是 rw 还是 ro)
- label (devicemapper 标签,仅当存在时)
- 字段 (fields)
- free (整数,字节)
- total (整数,字节)
- used (整数,字节)
- used_percent (浮点数,百分比)
- inodes_free (整数,文件数)
- inodes_total (整数,文件数)
- inodes_used (整数,文件数)
- inodes_used_percent (浮点数,百分比)
- 标签 (tags)
故障排除
在 Linux 上,磁盘列表取自 /proc/self/mounts 文件,并在第二列上调用 statfs。如果缺少任何预期的文件系统,请确保 telegraf 用户可以读取这些文件。
$ sudo -u telegraf cat /proc/self/mounts | grep sda2
/dev/sda2 /home ext4 rw,relatime,data=ordered 0 0
$ sudo -u telegraf stat /home可能需要使用 POSIX ACL 来提供额外的访问权限。
sudo setfacl -R -m u:telegraf:X /var/lib/docker/volumes/示例输出
disk,fstype=hfs,mode=ro,path=/ free=398407520256i,inodes_free=97267461i,inodes_total=121847806i,inodes_used=24580345i,total=499088621568i,used=100418957312i,used_percent=20.131039916242397,inodes_used_percent=20.1729894 1453832006274071563
disk,fstype=devfs,mode=rw,path=/dev free=0i,inodes_free=0i,inodes_total=628i,inodes_used=628i,total=185856i,used=185856i,used_percent=100,inodes_used_percent=100 1453832006274137913
disk,fstype=autofs,mode=rw,path=/net free=0i,inodes_free=0i,inodes_total=0i,inodes_used=0i,total=0i,used=0i,used_percent=0,inodes_used_percent=0 1453832006274157077
disk,fstype=autofs,mode=rw,path=/home free=0i,inodes_free=0i,inodes_total=0i,inodes_used=0i,total=0i,used=0i,used_percent=0,inodes_used_percent=0 1453832006274169688
disk,device=dm-1,fstype=xfs,label=lvg-lv,mode=rw,path=/mnt inodes_free=8388605i,inodes_used=3i,total=17112760320i,free=16959598592i,used=153161728i,used_percent=0.8950147441789215,inodes_total=8388608i,inodes_used_percent=0.0017530778 1677001387000000000此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。