目录
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。当您将任何数据视为时序数据时,它都更有价值。借助 InfluxDB,这个旨在与 Telegraf 协同扩展的排名第一的时序平台。
了解入门方法
输入和输出集成概览
此插件从 Google Cloud PubSub 提取指标,从而实现实时数据处理并集成到监控设置中。
Telegraf 的 SQL 输出插件通过为每种指标类型动态创建表,将指标存储在 SQL 数据库中。当配置为 SQLite 时,它使用基于文件的 DSN 和为轻量级嵌入式数据库使用量身定制的最小 SQL 模式。
集成详情
Google Cloud PubSub
Google Cloud PubSub 输入插件旨在从 Google Cloud PubSub 提取指标,Google Cloud PubSub 是一种消息传递服务,可促进不同系统之间的实时通信。它允许用户通过从 Google Cloud 项目中的指定订阅中拉取消息来创建和处理指标。此插件的关键功能之一是它能够作为服务输入运行,主动侦听传入消息,而不是仅以设定的时间间隔轮询指标。通过各种配置选项,用户可以自定义消息提取的行为,例如处理凭据、管理消息大小以及调整确认设置,以确保仅在成功处理后才确认消息。通过利用 Google PubSub 的优势,此插件与云原生架构无缝集成,使用户能够构建可以实时响应事件的强大且可扩展的应用程序。
SQLite
SQL 输出插件使用动态模式将 Telegraf 指标写入 SQL 数据库,其中每种指标类型对应一个表。对于 SQLite,该插件使用 modernc.org/sqlite 驱动程序,并且需要文件 URI 格式的 DSN(例如,“file:/path/to/telegraf.db?cache=shared”)。此配置利用标准 ANSI SQL 进行表创建和数据插入,从而确保与 SQLite 的功能兼容。
配置
Google Cloud PubSub
[[inputs.cloud_pubsub]]
project = "my-project"
subscription = "my-subscription"
data_format = "influx"
# credentials_file = "path/to/my/creds.json"
# retry_delay_seconds = 5
# max_message_len = 1000000
# max_undelivered_messages = 1000
# max_extension = 0
# max_outstanding_messages = 0
# max_outstanding_bytes = 0
# max_receiver_go_routines = 0
# base64_data = false
# content_encoding = "identity"
# max_decompression_size = "500MB"
SQLite
[[outputs.sql]]
## Database driver
## Valid options: mssql (Microsoft SQL Server), mysql (MySQL), pgx (Postgres),
## sqlite (SQLite3), snowflake (snowflake.com), clickhouse (ClickHouse)
driver = "sqlite"
## Data source name
## For SQLite, the DSN is a filename or URL with the scheme "file:".
## Example: "file:/path/to/telegraf.db?cache=shared"
data_source_name = "file:/path/to/telegraf.db?cache=shared"
## 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
## The values on the left are the data types Telegraf has and the values on the right are the SQL types used when writing to SQLite.
#[outputs.sql.convert]
# integer = "INT"
# real = "DOUBLE"
# text = "TEXT"
# timestamp = "TIMESTAMP"
# defaultvalue = "TEXT"
# unsigned = "UNSIGNED"
# bool = "BOOL"
输入和输出集成示例
Google Cloud PubSub
-
物联网设备的实时分析:利用 Google Cloud PubSub 插件聚合来自分布在各个位置的物联网设备的指标。通过将设备数据流式传输到 Google PubSub 并使用此插件提取指标,组织可以创建用于实时监控和警报的集中式仪表板。此设置可以立即深入了解设备性能,从而促进主动维护和运营效率。
-
动态日志处理和监控:通过 Google Cloud PubSub 将来自众多来源的日志提取到 Telegraf 管道中,利用该插件解析和分析日志消息。这可以帮助团队快速识别日志中的异常或模式,并简化跨分布式系统的问题排除过程。通过整合日志数据,组织可以增强其可观测性和响应能力。
-
事件驱动的工作流集成:使用 Google Cloud PubSub 插件连接各种云功能或服务。每次新消息推送到订阅时,都可以在云架构的其他部分触发操作,例如启动数据处理作业、通知,甚至报告更新。这种事件驱动的方法允许构建更具响应性的系统架构,可以适应不断变化的业务需求。
SQLite
- 本地监控存储:配置插件将指标写入本地 SQLite 数据库文件。这非常适合不需要设置全规模数据库服务器的轻量级部署。
- 嵌入式应用程序:将 SQLite 用作嵌入在边缘设备中的应用程序的后端,受益于其基于文件的架构和最低的资源需求。
- 快速设置进行测试:利用 SQLite 的易用性,快速设置 Telegraf 指标收集的测试环境,而无需外部数据库服务。
- 自定义模式管理:如果您需要特定的列类型或索引,请调整表创建模板以预定义您的模式,从而确保与您的应用程序需求兼容。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提供意见。请在 InfluxDB 社区 Slack 中提交您的反馈。
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。当您将任何数据视为时序数据时,它都更有价值。借助 InfluxDB,这个旨在与 Telegraf 协同扩展的排名第一的时序平台。
了解入门方法