目录
输入和输出集成概览
Consul Input Plugin 从 Consul 服务器收集健康检查指标,允许用户有效地监控服务状态。
Telegraf 的 SQL 插件使用简单的表模式和动态列生成将收集的指标发送到 SQL 数据库。当配置为 ClickHouse 时,它会调整 DSN 格式和类型转换设置,以确保无缝数据集成。
集成详情
Consul
Consul Input Plugin 旨在收集从 Consul 注册的所有服务的健康检查状态,Consul 是一种用于服务发现和基础设施管理的工具。通过查询 Consul API,此插件帮助用户监控其服务的健康状况,并确保它们正常运行并满足服务级别协议。它不提供遥测数据,但如果用户想要收集这些指标,可以使用 StatsD。该插件提供配置选项以连接到 Consul 服务器、管理身份验证以及指定如何处理从健康检查派生的标签。
Clickhouse
Telegraf 的 SQL 插件旨在通过基于传入指标动态创建表和列,将指标数据写入 SQL 数据库。当配置为 ClickHouse 时,它使用 clickhouse-go v1.5.4 驱动程序,该驱动程序采用独特的 DSN 格式和一组专门的类型转换规则,将 Telegraf 的数据类型直接映射到 ClickHouse 的原生类型。这种方法确保了高吞吐量环境中的最佳存储和检索性能,使其非常适合实时分析和大规模数据仓库。动态模式创建和精确的类型映射实现了详细的时序数据日志记录,这对于监控现代分布式系统至关重要。
配置
Consul
[[inputs.consul]]
## Consul server address
# address = "localhost:8500"
## URI scheme for the Consul server, one of "http", "https"
# scheme = "http"
## Metric version controls the mapping from Consul metrics into
## Telegraf metrics. Version 2 moved all fields with string values
## to tags.
##
## example: metric_version = 1; deprecated in 1.16
## metric_version = 2; recommended version
# metric_version = 1
## ACL token used in every request
# token = ""
## HTTP Basic Authentication username and password.
# username = ""
# password = ""
## Data center to query the health checks from
# datacenter = ""
## 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 = true
## Consul checks' tag splitting
# When tags are formatted like "key:value" with ":" as a delimiter then
# they will be split and reported as proper key:value in Telegraf
# tag_delimiter = ":"
Clickhouse
[[outputs.sql]]
## Database driver
## Valid options include mssql, mysql, pgx, sqlite, snowflake, clickhouse
driver = "clickhouse"
## Data source name
## For ClickHouse, the DSN follows the clickhouse-go v1.5.4 format.
## Example DSN: "tcp://localhost:9000?debug=true"
data_source_name = "tcp://localhost:9000?debug=true"
## Timestamp column name
timestamp_column = "timestamp"
## Table creation template
## Available template variables:
## {TABLE} - table name as a quoted identifier
## {TABLELITERAL} - table name as a quoted string literal
## {COLUMNS} - column definitions (list of quoted identifiers and types)
table_template = "CREATE TABLE {TABLE} ({COLUMNS})"
## Table existence check template
## Available template variables:
## {TABLE} - table name as a quoted identifier
table_exists_template = "SELECT 1 FROM {TABLE} LIMIT 1"
## Initialization SQL (optional)
init_sql = ""
## Maximum amount of time a connection may be idle. "0s" means connections are never closed due to idle time.
connection_max_idle_time = "0s"
## Maximum amount of time a connection may be reused. "0s" means connections are never closed due to age.
connection_max_lifetime = "0s"
## Maximum number of connections in the idle connection pool. 0 means unlimited.
connection_max_idle = 2
## Maximum number of open connections to the database. 0 means unlimited.
connection_max_open = 0
## Metric type to SQL type conversion for ClickHouse.
## The conversion maps Telegraf metric types to ClickHouse native data types.
[outputs.sql.convert]
conversion_style = "literal"
integer = "Int64"
text = "String"
timestamp = "DateTime"
defaultvalue = "String"
unsigned = "UInt64"
bool = "UInt8"
real = "Float64"
输入和输出集成示例
Consul
-
服务健康监控仪表板:利用 Consul Input Plugin 为 Consul 注册的所有服务创建全面的健康监控仪表板。这允许运营团队实时可视化健康状态,从而快速识别服务问题并促进对服务中断或性能下降的快速响应。
-
自动化警报系统:实施自动化警报系统,该系统使用 Consul Input Plugin 收集的健康检查数据,在服务状态变为严重时触发通知。此设置可以与 Slack 或电子邮件等通知系统集成,确保团队成员立即收到警报以解决潜在问题。
-
与事件管理集成:利用 Consul Input Plugin 的健康检查数据来馈送到事件管理系统。通过分析健康状态趋势,团队可以根据受影响服务的关键性对事件进行优先级排序,并简化其解决流程,从而提高整体服务可靠性和客户满意度。
Clickhouse
-
高容量数据的实时分析:使用该插件将来自大规模系统的流式指标馈送到 ClickHouse。此设置支持超快速查询性能和近实时分析,非常适合监控高流量应用程序。
-
时序数据仓库:将该插件与 ClickHouse 集成,以创建强大的时序数据仓库。此用例允许组织存储详细的历史指标,并执行复杂的查询以进行趋势分析和容量规划。
-
分布式环境中的可扩展监控:利用该插件在 ClickHouse 中为每种指标类型动态创建表,从而更轻松地管理和查询来自大量分布式系统的数据,而无需事先定义模式。
-
物联网部署的优化存储:部署该插件以将来自物联网传感器的数据摄取到 ClickHouse 中。其高效的模式创建和原生类型映射有助于处理海量数据,从而实现实时监控和预测性维护。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提供意见。请在 InfluxDB 社区 Slack 中提交您的反馈。