基础指标采集插件
本文介绍监控数据采集器 Categraf 的基础指标 cpu、mem、disk、diskio、net 采集插件与配置
cpu 插件
功能: 采集cpu指标,包括cpu用户态/系统态使用量、中断、软中断等指标
注
- 如果不需要采集单个核心指标,推荐保持默认配置。
- 如果想修改插件的采集周期,在这里修改
interval的值
# # collect interval
# interval = 15
# # whether collect per cpu
# collect_per_cpu = false
mem 插件
功能: 采集内存指标,包括内存使用量、总量、cache、buffer、 available等指标
- 如果想修改插件的采集周期,在这里修改
interval的值 - 其中配置项
collect_platform_fields表示是否采集平台独有的指标
# # collect interval
# interval = 15
# # whether collect platform specified metrics
collect_platform_fields = true
disk 插件
功能:采集各个磁盘分区的空间/inode的使用量情况
注: 每个指标都有一个mode=rw 类似的label , 表示分区的挂载模式。
- 分区变为只读监控: 可以通过指标携带的label
mode=xx来实现, 比如disk_use_total{mode="ro"} > 0 - 磁盘故障监控: 可以通过
disk_device_error == 1判断 - 如果想修改插件的采集周期,在这里修改
interval的值
# # collect interval
# interval = 15
# # 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", "nsfs"]
ignore_mount_points = ["/boot", "/var/lib/kubelet/pods"]
diskio 插件
功能: 采集磁盘io指标,包括读写速率,读写次数,读写延迟等
- 如果想修改插件的采集周期,在这里修改
interval的值 - 可以通过devices参数限定只采集哪几块盘的指标
# # collect interval
# interval = 15
# # By default, categraf will gather stats for all devices including disk partitions.
# # Setting devices will restrict the stats to the specified devices.
# devices = ["sda", "sdb", "vd*"]
net插件
功能: 采集网络指标,包括网卡流量,包数,错误数等
注意:
- 如果想修改插件的采集周期,在这里修改
interval的值 collect_protocol_stats这个选项只在Linux下生效,如果不需要采集协议层指标,可以关闭该选项, 推荐保持默认。interfaces指定采集的网卡,如果不配置,默认为全部网卡。 支持通配符配置。
# # collect interval
# interval = 15
# # whether collect protocol stats on Linux
# # to be supported
# collect_protocol_stats = false
# # setting interfaces will tell categraf to gather these explicit interfaces
# interfaces = ["eth0"]