目录
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它都会变得更有价值。InfluxDB 是排名第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法
输入和输出集成概述
Docker 输入插件允许您使用 Docker Engine API 从 Docker 容器收集指标,从而增强容器化应用程序的可见性和监控。
此插件使用 Prometheus 远程写入协议通过 HTTP 将指标从 Telegraf 发送到 Thanos,从而可以高效且可扩展地摄取到 Thanos Receive 组件中。
集成详情
Docker
Telegraf 的 Docker 输入插件从 Docker Engine API 收集有价值的指标,提供对正在运行的容器的洞察。此插件利用官方 Docker 客户端与 Engine API 接口,允许用户监控各种容器状态、资源分配和性能指标。该插件提供按名称和状态过滤容器的选项,以及可自定义的标签,支持在各种环境中监控容器化应用程序的灵活性,无论是在本地系统上还是在 Kubernetes 等编排平台内。此外,它还通过要求访问 Docker 守护进程的权限来解决安全问题,并强调在容器化环境中部署时进行正确的配置。
Thanos
Telegraf 的 HTTP 插件可以通过其 Remote Write 兼容的 Receive 组件将指标直接发送到 Thanos。通过将数据格式设置为 prometheusremotewrite
,Telegraf 可以将指标序列化为与原生 Prometheus 客户端使用的相同的基于 protobuf 的格式。此设置实现了高吞吐量、低延迟的指标摄取到 Thanos 中,从而促进了大规模的集中式可观测性。这在混合环境中特别有用,在这些环境中,Telegraf 从 Prometheus 原生范围之外的系统(例如 SNMP 设备、Windows 主机或自定义应用程序)收集指标,并将它们直接流式传输到 Thanos 以进行长期存储和全局查询。
配置
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)
## Note: configure this in one of the manager nodes in a Swarm cluster.
## configuring in multiple Swarm managers results in duplication of metrics.
gather_services = false
## Only collect metrics for these containers. Values will be appended to
## container_name_include.
## Deprecated (1.4.0), use container_name_include
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. Collect all if empty. Globs accepted.
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.
# container_state_include = []
# container_state_exclude = []
## Objects to include for disk usage query
## Allowed values are "container", "image", "volume"
## When empty disk usage is excluded
storage_objects = []
## 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.
perdevice = true
## Specifies for which classes a per-device metric should be issued
## Possible values are 'cpu' (cpu0, cpu1, ...), 'blkio' (8:0, 8:1, ...) and 'network' (eth0, eth1, ...)
## Please note that this setting has no effect if 'perdevice' is set to 'true'
# perdevice_include = ["cpu"]
## Whether to report for each container total blkio and network stats or not.
## Usage of this setting is discouraged since it will be deprecated in favor of 'total_include'.
## Default value is 'false' for backwards compatibility, please set it to 'true' so that 'total_include' setting
## is honored.
total = false
## Specifies for which classes a total metric should be issued. Total is an aggregated of the 'perdevice' values.
## Possible values are 'cpu', 'blkio' and 'network'
## Total 'cpu' is reported directly by Docker daemon, and 'network' and 'blkio' totals are aggregated by this plugin.
## Please note that this setting has no effect if 'total' is set to 'false'
# total_include = ["cpu", "blkio", "network"]
## docker labels to include and exclude as tags. Globs accepted.
## Note that an empty array for both will include all labels as tags
docker_label_include = []
docker_label_exclude = []
## Which environment variables should we use as a tag
tag_env = ["JAVA_HOME", "HEAP_SIZE"]
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
Thanos
[[outputs.http]]
## Thanos Receive endpoint for remote write
url = "http://thanos-receive.example.com/api/v1/receive"
## HTTP method
method = "POST"
## Data format set to Prometheus remote write
data_format = "prometheusremotewrite"
## Optional headers (authorization, etc.)
# [outputs.http.headers]
# Authorization = "Bearer YOUR_TOKEN"
## Optional TLS configuration
# tls_ca = "/path/to/ca.pem"
# tls_cert = "/path/to/cert.pem"
# tls_key = "/path/to/key.pem"
# insecure_skip_verify = false
## Request timeout
timeout = "10s"
输入和输出集成示例
Docker
-
监控容器化应用程序的性能:使用 Docker 输入插件来跟踪 Docker 容器中运行的应用程序的 CPU、内存、磁盘 I/O 和网络活动。通过收集这些指标,DevOps 团队可以主动管理资源分配、排除性能瓶颈,并确保跨不同环境的最佳应用程序性能。
-
与 Kubernetes 集成:利用此插件来收集 Kubernetes 编排的 Docker 容器的指标。通过过滤掉不必要的 Kubernetes 标签并专注于关键指标,团队可以简化其监控解决方案并创建仪表板,从而深入了解 Kubernetes 集群中运行的微服务的整体健康状况。
-
容量规划和资源优化:使用 Docker 输入插件收集的指标来执行 Docker 部署的容量规划。分析使用模式有助于识别未充分利用的资源和过度配置的容器,从而指导基于实际使用趋势的扩展或缩减决策。
-
容器异常的自动警报:根据通过 Docker 插件收集的指标设置警报规则,以通知团队资源使用量异常激增或服务中断。这种主动监控方法有助于维护服务可靠性并优化容器化应用程序的性能。
Thanos
-
无代理云监控:在云虚拟机上部署 Telegraf 代理以收集系统和应用程序指标,然后使用 Remote Write 将它们直接流式传输到 Thanos。这提供了集中式可观测性,而无需在每个位置都部署 Prometheus 节点。
-
可扩展的 Windows 主机监控:在 Windows 机器上使用 Telegraf 收集操作系统级别的指标,并通过 Remote Write 将它们发送到 Thanos Receive。这实现了在异构环境中的可观测性,而原生 Prometheus 仅在 Linux 上受支持。
-
跨区域指标联合:多个地理区域中的 Telegraf 代理可以使用此插件将数据推送到区域本地的 Thanos Receivers。Thanos 可以从那里对指标进行重复数据删除和全局查询,从而降低延迟和网络出口成本。
-
将第三方数据集成到 Thanos 中:使用 Telegraf 输入从自定义遥测源(例如 REST API 或专有日志)收集指标,并通过 Remote Write 将它们转发到 Thanos。这会将非原生数据引入 Prometheus 兼容的长期分析管道。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提供意见。请在 InfluxDB 社区 Slack 中提交您的反馈。
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它都会变得更有价值。InfluxDB 是排名第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法