目录
输入和输出集成概述
Docker 输入插件允许您使用 Docker Engine API 从 Docker 容器中收集指标,从而增强容器化应用程序的可视性和监控。
Redis 插件使用户能够将 Telegraf 收集的指标直接发送到 Redis。此集成非常适合需要强大的时间序列数据存储和分析的应用程序。
集成详情
Docker
Telegraf 的 Docker 输入插件从 Docker Engine API 收集有价值的指标,从而深入了解正在运行的容器。此插件利用官方 Docker 客户端与 Engine API 交互,使用户能够监控各种容器状态、资源分配和性能指标。通过按名称和状态过滤容器的选项,以及可自定义的标签,此插件支持在各种环境中监控容器化应用程序的灵活性,无论是在本地系统上还是在 Kubernetes 等编排平台中。此外,它通过要求访问 Docker 守护进程的权限来解决安全问题,并强调在容器化环境中部署时的正确配置。
Redis
Redis Telegraf 插件旨在将指标写入 RedisTimeSeries,这是一个专门用于时间序列数据的 Redis 数据库模块。此插件促进了 Telegraf 与 RedisTimeSeries 的集成,从而可以高效地存储和检索带时间戳的数据。借助 RedisTimeSeries,用户可以利用增强的功能来管理时间序列数据,包括聚合视图和范围查询。该插件提供了各种配置选项,以实现安全连接到 Redis 数据库所需的灵活性,包括对身份验证、超时、数据类型转换和 TLS 配置的支持。底层技术利用了 Redis 的效率和可扩展性,使其成为高容量指标环境的绝佳选择,在这些环境中,实时处理至关重要。
配置
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
Redis
[[outputs.redistimeseries]]
## The address of the RedisTimeSeries server.
address = "127.0.0.1:6379"
## Redis ACL credentials
# username = ""
# password = ""
# database = 0
## Timeout for operations such as ping or sending metrics
# timeout = "10s"
## Enable attempt to convert string fields to numeric values
## If "false" or in case the string value cannot be converted the string
## field will be dropped.
# convert_string_fields = true
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
# insecure_skip_verify = false
输入和输出集成示例
Docker
-
监控容器化应用程序的性能:使用 Docker 输入插件来跟踪在 Docker 容器中运行的应用程序的 CPU、内存、磁盘 I/O 和网络活动。通过收集这些指标,DevOps 团队可以主动管理资源分配、排除性能瓶颈,并确保跨不同环境的最佳应用程序性能。
-
与 Kubernetes 集成:利用此插件收集由 Kubernetes 编排的 Docker 容器的指标。通过过滤掉不必要的 Kubernetes 标签并专注于关键指标,团队可以简化其监控解决方案并创建仪表板,以深入了解在 Kubernetes 集群中运行的微服务的整体健康状况。
-
容量规划和资源优化:使用 Docker 输入插件收集的指标来执行 Docker 部署的容量规划。分析使用模式有助于识别未充分利用的资源和过度配置的容器,从而指导根据实际使用趋势扩展或缩减的决策。
-
容器异常的自动警报:根据通过 Docker 插件收集的指标设置警报规则,以通知团队资源使用量异常激增或服务中断。这种主动监控方法有助于维护服务可靠性并优化容器化应用程序的性能。
Redis
-
监控 IoT 传感器数据:利用 Redis Telegraf 插件实时收集和存储来自 IoT 传感器的数据。通过将插件连接到 RedisTimeSeries 数据库,用户可以分析温度、湿度或其他环境因素的趋势。高效查询历史传感器数据的能力将有助于预测性维护并帮助资源管理。
-
金融市场数据聚合:使用此插件跟踪和存储来自各种来源的时间敏感型金融数据。通过将指标发送到 Redis,金融机构可以聚合和分析市场趋势或价格随时间的变化,从而为他们提供从可靠的时间序列分析中得出的可操作的见解。
-
应用程序性能监控 (APM):实施 Redis 插件以收集应用程序性能指标,例如响应时间和 CPU 使用率。用户可以使用 RedisTimeSeries 可视化其应用程序随时间的性能,从而使他们能够快速识别瓶颈并优化资源分配。
-
能源消耗跟踪:利用此插件监控建筑物随时间的能源使用情况。通过与智能电表集成并将数据发送到 RedisTimeSeries,市政当局或企业可以分析能源消耗模式,从而帮助实施节能措施和可持续发展实践。
反馈
感谢您成为我们社区的一份子!如果您有任何一般反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。