目录
输入和输出集成概述
Google Cloud Storage 插件从指定的 Google Cloud Storage 存储桶收集指标,从而深入了解存储使用情况和性能。
Telegraf 的 SQL 输出插件通过为每种指标类型动态创建表,将指标存储在 SQL 数据库中。 当配置为 SQLite 时,它使用基于文件的 DSN 和针对轻量级嵌入式数据库使用量身定制的最小 SQL 模式。
集成详情
Google Cloud Storage
Google Cloud Storage Telegraf 插件可以从指定的 Google Cloud Storage 存储桶收集指标。 随着组织越来越依赖云存储解决方案进行数据管理,监控这些资源的性能和利用率的能力变得至关重要。 此插件特别适用于跟踪存储的使用方式、了解数据模式以及确保运营效率。 通过与 Google Cloud Storage API 集成,它允许用户从其云环境收集见解,并将指标直接馈送到监控系统以进行进一步分析。 该插件支持各种配置选项,使用户可以根据其特定需求自定义数据收集过程。
SQLite
SQL 输出插件使用动态模式将 Telegraf 指标写入 SQL 数据库,其中每种指标类型对应一个表。 对于 SQLite,该插件使用 modernc.org/sqlite 驱动程序,并且需要文件 URI 格式的 DSN(例如,'file:/path/to/telegraf.db?cache=shared')。 此配置利用标准 ANSI SQL 进行表创建和数据插入,确保与 SQLite 的功能兼容。
配置
Google Cloud Storage
[[inputs.google_cloud_storage]]
bucket = "my-bucket"
# key_prefix = "my-bucket"
offset_key = "offset_key"
objects_per_iteration = 10
data_format = "influx"
# credentials_file = "path/to/my/creds.json"
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 Storage
-
自动化备份监控: 利用 Google Cloud Storage 插件定期监控存储在 Cloud Storage 存储桶中的备份文件的状态。 通过配置插件以跟踪文件指标,组织可以自动发出警报,以防备份大小偏离预期模式,从而确保数据保护流程正常运行并及时解决任何异常。
-
成本优化洞察: 将此插件集成到成本管理工具中,以分析 Cloud Storage 的使用模式。 通过收集有关文件大小和访问频率的指标,团队可以优化其存储解决方案,并就数据保留策略做出明智的决策,从而可能减少不必要的存储成本并改善资源分配。
-
合规性和审计: 使用此插件生成有助于验证存储在 Google Cloud Storage 中的数据合规性的指标。 通过提供有关数据访问和存储使用情况的详细见解,组织可以确保遵守法规要求,从而有助于审计并符合数据治理的最佳实践。
-
性能基准测试: 部署此插件以基准测试 Google Cloud Storage 中数据检索和存储操作的性能。 通过随时间推移分析指标,团队可以识别性能瓶颈或效率低下问题,从而优化依赖云存储服务的应用程序和基础设施。
SQLite
- 本地监控存储: 将插件配置为将指标写入本地 SQLite 数据库文件。 这非常适合不需要设置完整数据库服务器的轻量级部署。
- 嵌入式应用程序: 将 SQLite 用作嵌入在边缘设备中的应用程序的后端,受益于其基于文件的架构和最低的资源要求。
- 快速设置以进行测试: 利用 SQLite 的易用性,快速设置 Telegraf 指标收集的测试环境,而无需外部数据库服务。
- 自定义架构管理: 如果您需要特定的列类型或索引,请调整表创建模板以预定义您的架构,从而确保与您的应用程序需求兼容。
反馈
感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。