【实践笔记】Telegraf如何采集docker容器性能指标

这里写自定义目录标题问题背景解决过程问题背景目标:实现对 docker 容器的性能监控背景:已部署 GTI(Grafana+Telegraf+Influxdb)问题:如何让 telegraf 能够采集到 docker 容器的性能指标?解决过程已知 telegraf 自带多种插件可用于对多种类型对象的指标采集,查看 /etc/telegraf/telegraf.conf 配置文件能发现配置项 [[inputs.docker]],去掉该项注释并合理进行配置即可。较完整的配置项内容如下:[[inpu
摘要由CSDN通过智能技术生成

这里写自定义目录标题

问题背景

目标:实现对 docker 容器的性能监控
背景:已部署 GTI(Grafana+Telegraf+Influxdb)
问题:如何让 telegraf 能够采集到 docker 容器的性能指标?

解决过程

已知 telegraf 自带多种插件可用于对多种类型对象的指标采集,查看 /etc/telegraf/telegraf.conf 配置文件能发现配置项 [[inputs.docker]],去掉该项注释并合理进行配置即可。较完整的配置项内容如下:

[[inputs.docker]]
#   ## Docker Endpoint
#   ##   To use TCP, set endpoint = "tcp://[ip]:[port]"
#   ##   To use environment variables (ie, docker-machine), set endpoint = "ENV"
#   endpoint = "unix:///var/run/docker.sock"
#
#   ## Set to true to collect Swarm metrics(desired_replicas, running_replicas)
#   gather_services = false
#
#   ## Only collect metrics for these containers, collect all if empty
#   container_names = []
#
#   ## Set the source tag for the metrics to the container ID hostname, eg first 12 chars
#   source_tag = false
#
#   ## Containers to include and exclude. Globs accepted.
#   ## Note that an empty array for both will include all containers
#   container_name_include = []
#   container_name_exclude = []
#
#   ## Container states to include and exclude. Globs accepted.
#   ## When empty only containers in the "running" state will be captured.
#   ## example: container_state_include = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
#   ## example: container_state_exclude = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
#   # container_state_include = []
#   # container_state_exclude = []
#
#   ## Timeout for docker list, info, and stats commands
#   timeout = "5s"
#
#   ## Whether to report for each container per-device blkio (8:0, 8:1...),
#   ## network (eth0, eth1, ...) and cpu (cpu0, cpu1, ...) stats or not.
#   ## Usage of this setting is discouraged since it will be deprecated in favor of 'perdevice_include'.
#   ## Default value is 'true' for backwards compatibility, please set it to 'false' so that 'perdevice_include' setting
#   ## is honored.<
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值