目录
输入和输出集成概述
Zipkin 输入插件允许从微服务收集跟踪信息和计时数据。此功能对于诊断复杂面向服务环境中的延迟问题至关重要。
Telegraf Elasticsearch 插件无缝地将指标发送到 Elasticsearch 服务器。该插件处理模板创建和动态索引管理,并支持各种 Elasticsearch 特有的功能,以确保数据格式正确,以便存储和检索。
集成详情
Zipkin
该插件实现了 Zipkin HTTP 服务器,以收集故障排除微服务架构中延迟问题所需的跟踪和计时数据。Zipkin 是一个分布式跟踪系统,可帮助收集跨各种微服务的计时数据,使团队能够可视化请求流并识别性能瓶颈。该插件支持基于指定 Content-Type 的 JSON 或 thrift 格式的输入跟踪。此外,它还利用 span 元数据来跟踪请求的计时,从而增强了符合 OpenTracing 标准的应用程序的可观察性。作为一项实验性功能,其配置和架构可能会随着时间的推移而演变,以更好地满足用户需求和分布式跟踪方法的进步。
Elasticsearch
该插件将指标写入 Elasticsearch,这是一个分布式 RESTful 搜索和分析引擎,能够近乎实时地存储大量数据。它旨在处理 Elasticsearch 5.x 到 7.x 版本,并利用其动态模板功能来正确管理数据类型映射。该插件支持高级功能,例如模板管理、动态索引命名以及与 OpenSearch 的集成。它还允许配置 Elasticsearch 节点的身份验证和健康状况监控。
配置
Zipkin
[[inputs.zipkin]]
## URL path for span data
# path = "/api/v1/spans"
## Port on which Telegraf listens
# port = 9411
## Maximum duration before timing out read of the request
# read_timeout = "10s"
## Maximum duration before timing out write of the response
# write_timeout = "10s"
Elasticsearch
[[outputs.elasticsearch]]
## The full HTTP endpoint URL for your Elasticsearch instance
## Multiple urls can be specified as part of the same cluster,
## this means that only ONE of the urls will be written to each interval
urls = [ "http://node1.es.example.com:9200" ] # required.
## Elasticsearch client timeout, defaults to "5s" if not set.
timeout = "5s"
## Set to true to ask Elasticsearch a list of all cluster nodes,
## thus it is not necessary to list all nodes in the urls config option
enable_sniffer = false
## Set to true to enable gzip compression
enable_gzip = false
## Set the interval to check if the Elasticsearch nodes are available
## Setting to "0s" will disable the health check (not recommended in production)
health_check_interval = "10s"
## Set the timeout for periodic health checks.
# health_check_timeout = "1s"
## HTTP basic authentication details.
## HTTP basic authentication details
# username = "telegraf"
# password = "mypassword"
## HTTP bearer token authentication details
# auth_bearer_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
## Index Config
## The target index for metrics (Elasticsearch will create if it not exists).
## You can use the date specifiers below to create indexes per time frame.
## The metric timestamp will be used to decide the destination index name
# %Y - year (2016)
# %y - last two digits of year (00..99)
# %m - month (01..12)
# %d - day of month (e.g., 01)
# %H - hour (00..23)
# %V - week of the year (ISO week) (01..53)
## Additionally, you can specify a tag name using the notation {{tag_name}}
## which will be used as part of the index name. If the tag does not exist,
## the default tag value will be used.
# index_name = "telegraf-{{host}}-%Y.%m.%d"
# default_tag_value = "none"
index_name = "telegraf-%Y.%m.%d" # required.
## Optional Index Config
## Set to true if Telegraf should use the "create" OpType while indexing
# use_optype_create = false
## 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
## Template Config
## Set to true if you want telegraf to manage its index template.
## If enabled it will create a recommended index template for telegraf indexes
manage_template = true
## The template name used for telegraf indexes
template_name = "telegraf"
## Set to true if you want telegraf to overwrite an existing template
overwrite_template = false
## If set to true a unique ID hash will be sent as sha256(concat(timestamp,measurement,series-hash)) string
## it will enable data resend and update metric points avoiding duplicated metrics with different id's
force_document_id = false
## Specifies the handling of NaN and Inf values.
## This option can have the following values:
## none -- do not modify field-values (default); will produce an error if NaNs or infs are encountered
## drop -- drop fields containing NaNs or infs
## replace -- replace with the value in "float_replacement_value" (default: 0.0)
## NaNs and inf will be replaced with the given number, -inf with the negative of that number
# float_handling = "none"
# float_replacement_value = 0.0
## Pipeline Config
## To use a ingest pipeline, set this to the name of the pipeline you want to use.
# use_pipeline = "my_pipeline"
## Additionally, you can specify a tag name using the notation {{tag_name}}
## which will be used as part of the pipeline name. If the tag does not exist,
## the default pipeline will be used as the pipeline. If no default pipeline is set,
## no pipeline is used for the metric.
# use_pipeline = "{{es_pipeline}}"
# default_pipeline = "my_pipeline"
#
# Custom HTTP headers
# To pass custom HTTP headers please define it in a given below section
# [outputs.elasticsearch.headers]
# "X-Custom-Header" = "custom-value"
## Template Index Settings
## Overrides the template settings.index section with any provided options.
## Defaults provided here in the config
# template_index_settings = {
# refresh_interval = "10s",
# mapping.total_fields.limit = 5000,
# auto_expand_replicas = "0-1",
# codec = "best_compression"
# }
输入和输出集成示例
Zipkin
-
微服务中的延迟监控:使用 Zipkin 输入插件捕获和分析来自微服务架构的跟踪数据。通过可视化请求流并查明延迟来源,开发团队可以优化服务交互,缩短响应时间,并确保跨服务的更流畅的用户体验。
-
关键服务中的性能优化:在关键服务中集成该插件,不仅可以监控响应时间,还可以跟踪可能突出显示性能问题的特定注释。收集 span 数据的能力可以帮助确定需要性能增强的领域,从而实现有针对性的改进。
-
动态服务依赖关系映射:利用收集的跟踪数据,自动映射服务依赖关系并在仪表板中可视化它们。这有助于团队了解不同服务如何交互以及故障或速度减慢的影响,最终促成更好的架构决策和更快的问题解决。
-
服务延迟中的异常检测:将 Zipkin 数据与机器学习模型相结合,以检测服务延迟和请求处理时间中的异常模式。通过自动识别异常,运营团队可以在新兴问题升级为严重故障之前主动响应。
Elasticsearch
-
基于时间的索引:使用此插件将指标存储在 Elasticsearch 中,以根据收集的时间为每个指标建立索引。例如,CPU 指标可以存储在名为
telegraf-2023.01.01
的每日索引中,从而可以轻松进行基于时间的查询和保留策略。 -
动态模板管理:利用模板管理功能自动创建针对您的指标量身定制的自定义模板。这使您可以定义如何索引和分析不同的字段,而无需手动配置 Elasticsearch,从而确保用于查询的最佳数据结构。
-
OpenSearch 兼容性:如果您正在使用 AWS OpenSearch,则可以通过激活兼容模式来配置此插件以无缝工作,从而确保您现有的 Elasticsearch 客户端保持功能正常并与较新的集群设置兼容。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。