目录
输入和输出集成概述
Amazon ECS 输入插件使 Telegraf 能够从 AWS ECS 容器收集指标,从而提供有关容器性能和资源使用情况的详细见解。
InfluxDB 插件将指标写入 InfluxDB HTTP 服务,从而可以高效地存储和检索时序数据。
集成详情
Amazon ECS
Telegraf 的 Amazon ECS 插件旨在从在 AWS Fargate 或 EC2 实例上运行的 ECS (Elastic Container Service) 任务中收集指标。通过利用 ECS 元数据和统计 API 端点(v2 和 v3),它可以获取任务内容器性能和健康状况的实时信息。此插件与被检查的工作负载在同一任务中运行,确保无缝访问元数据和统计信息。值得注意的是,它结合了 ECS 特有的功能,这些功能使其与 Docker 输入插件区分开来,例如处理独特的 ECS 元数据格式和统计信息。用户可以包含或排除特定容器,并调整要监视的容器状态,以及为 ECS 标签定义标签选项。这种灵活性允许定制的监控体验,以满足 ECS 环境的特定需求,从而增强对容器化应用程序的可观察性和控制。
InfluxDB
InfluxDB Telegraf 插件用于将指标发送到 InfluxDB HTTP API,从而以结构化方式促进时序数据的存储和查询。此插件与 InfluxDB 无缝集成,提供令牌身份验证和对多个 InfluxDB 集群节点的支持等基本功能,从而确保可靠且可扩展的数据摄取。通过其可配置性,用户可以指定组织、目标存储桶和 HTTP 特定设置等选项,从而灵活地定制数据的发送和存储方式。该插件还支持敏感数据的密钥管理,从而增强了生产环境中的安全性。在实时分析和时序数据存储至关重要的现代可观察性堆栈中,此插件尤其有用。
配置
Amazon ECS
[[inputs.ecs]]
# endpoint_url = ""
# container_name_include = []
# container_name_exclude = []
# container_status_include = []
# container_status_exclude = []
ecs_label_include = [ "com.amazonaws.ecs.*" ]
ecs_label_exclude = []
# timeout = "5s"
[[inputs.ecs]]
endpoint_url = "http://169.254.170.2"
# container_name_include = []
# container_name_exclude = []
# container_status_include = []
# container_status_exclude = []
ecs_label_include = [ "com.amazonaws.ecs.*" ]
ecs_label_exclude = []
# timeout = "5s"
InfluxDB
[[outputs.influxdb]]
## The full HTTP or UDP URL for your InfluxDB instance.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
# urls = ["unix:///var/run/influxdb.sock"]
# urls = ["udp://127.0.0.1:8089"]
# urls = ["http://127.0.0.1:8086"]
## Local address to bind when connecting to the server
## If empty or not set, the local address is automatically chosen.
# local_address = ""
## The target database for metrics; will be created as needed.
## For UDP url endpoint database needs to be configured on server side.
# database = "telegraf"
## The value of this tag will be used to determine the database. If this
## tag is not set the 'database' option is used as the default.
# database_tag = ""
## If true, the 'database_tag' will not be included in the written metric.
# exclude_database_tag = false
## If true, no CREATE DATABASE queries will be sent. Set to true when using
## Telegraf with a user without permissions to create databases or when the
## database already exists.
# skip_database_creation = false
## Name of existing retention policy to write to. Empty string writes to
## the default retention policy. Only takes effect when using HTTP.
# retention_policy = ""
## The value of this tag will be used to determine the retention policy. If this
## tag is not set the 'retention_policy' option is used as the default.
# retention_policy_tag = ""
## If true, the 'retention_policy_tag' will not be included in the written metric.
# exclude_retention_policy_tag = false
## Write consistency (clusters only), can be: "any", "one", "quorum", "all".
## Only takes effect when using HTTP.
# write_consistency = "any"
## Timeout for HTTP messages.
# timeout = "5s"
## HTTP Basic Auth
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
## HTTP User-Agent
# user_agent = "telegraf"
## UDP payload size is the maximum packet size to send.
# udp_payload = "512B"
## Optional TLS Config for use on HTTP connections.
# 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
## HTTP Proxy override, if unset values the standard proxy environment
## variables are consulted to determine which proxy, if any, should be used.
# http_proxy = "http://corporate.proxy:3128"
## Additional HTTP headers
# http_headers = {"X-Special-Header" = "Special-Value"}
## HTTP Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "gzip"
## When true, Telegraf will output unsigned integers as unsigned values,
## i.e.: "42u". You will need a version of InfluxDB supporting unsigned
## integer values. Enabling this option will result in field type errors if
## existing data has been written.
# influx_uint_support = false
## When true, Telegraf will omit the timestamp on data to allow InfluxDB
## to set the timestamp of the data during ingestion. This is generally NOT
## what you want as it can lead to data points captured at different times
## getting omitted due to similar data.
# influx_omit_timestamp = false
输入和输出集成示例
Amazon ECS
-
动态容器监控:使用 Amazon ECS 插件在自动扩展 ECS 架构中动态监控容器运行状况。当新容器启动或关闭时,插件将自动调整其收集的指标,确保有效捕获每个容器的性能数据,而无需手动配置。
-
自定义资源分配警报:实施 ECS 插件以建立每个容器的资源使用阈值。通过与通知系统集成,团队可以在容器的 CPU 或内存使用量超过预定义限制时收到警报,从而实现主动资源管理并保持应用程序性能。
-
成本优化仪表板:利用从 ECS 插件收集的指标创建仪表板,以可视化每个容器的资源使用情况和相关成本。这种洞察力使组织能够识别未充分利用的资源,优化与其容器基础设施相关的成本,从而提高云运营的财务效率。
-
高级容器安全监控:结合安全工具使用此插件来监控 ECS 容器指标中的异常情况。通过持续分析使用模式,可以检测到任何突然的峰值或不规则行为,从而触发自动安全响应并维护系统完整性。
InfluxDB
-
实时系统监控:利用 InfluxDB 插件捕获和存储来自各种系统组件的指标,例如 CPU 使用率、内存消耗和磁盘 I/O。通过将这些指标推送到 InfluxDB,您可以创建一个实时仪表板,可视化系统性能。此设置不仅有助于识别性能瓶颈,还有助于通过分析长期趋势来主动进行容量规划。
-
Web 应用程序的性能跟踪:自动收集与 Web 应用程序性能相关的指标(例如请求持续时间、错误率和用户交互)并将其推送到 InfluxDB。通过在您的监控堆栈中使用此插件,您可以使用存储的指标生成报告和分析,帮助了解用户行为和应用程序效率,从而指导开发和优化工作。
-
物联网数据聚合:利用 InfluxDB Telegraf 插件从各种物联网设备收集传感器数据,并将其存储在集中的 InfluxDB 实例中。此用例使您能够分析环境或机器数据随时间变化的趋势和模式,从而促进更明智的决策和预测性维护策略。通过将物联网数据集成到 InfluxDB 中,组织可以利用历史数据分析的力量来推动创新和运营效率。
-
分析历史指标以进行预测:设置 InfluxDB 插件以将历史指标数据发送到 InfluxDB,并使用它来驱动预测模型。通过分析过去的性能指标,您可以创建预测未来趋势和需求的预测模型。此应用程序对于商业智能目的尤其有用,可以帮助组织根据历史使用模式为资源需求的波动做好准备。
反馈
感谢您成为我们社区的一员!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。