目录
强大性能,无限扩展
收集、组织和处理海量高速数据。 当您将任何数据视为时序数据时,它都会更有价值。 使用 InfluxDB,这是排名第一的、旨在与 Telegraf 一起扩展的时序平台。
查看入门方法
输入和输出集成概述
使用 Azure 监视器 API 从 Azure 资源收集指标。
Telegraf 的 SQL 输出插件通过为每种指标类型动态创建表,将指标存储在 SQL 数据库中。 当配置为 SQLite 时,它使用基于文件的 DSN 和为轻量级嵌入式数据库使用量身定制的最小 SQL 模式。
集成详情
Azure 监视器
Azure 监视器 Telegraf 插件专为使用 Azure 监视器 API 从各种 Azure 资源收集指标而设计。 用户必须提供特定的凭据,例如 client_id
、client_secret
、tenant_id
和 subscription_id
,以进行身份验证并获得对其 Azure 资源的访问权限。 此外,该插件还支持从单个资源和资源组或订阅中收集指标的功能,从而可以灵活且可扩展地收集针对用户需求的指标。 此插件非常适合利用 Azure 云基础设施的组织,可以深入了解资源性能和长期利用率,从而促进云资源的积极管理和优化。
SQLite
SQL 输出插件使用动态模式将 Telegraf 指标写入 SQL 数据库,其中每种指标类型对应于一个表。 对于 SQLite,该插件使用 modernc.org/sqlite 驱动程序,并且需要 DSN 采用文件 URI 格式(例如,“file:/path/to/telegraf.db?cache=shared”)。 此配置利用标准 ANSI SQL 进行表创建和数据插入,确保与 SQLite 的功能兼容。
配置
Azure 监视器
# Gather Azure resources metrics from Azure Monitor API
[[inputs.azure_monitor]]
# can be found under Overview->Essentials in the Azure portal for your application/service
subscription_id = "<>"
# can be obtained by registering an application under Azure Active Directory
client_id = "<>"
# can be obtained by registering an application under Azure Active Directory.
# If not specified Default Azure Credentials chain will be attempted:
# - Environment credentials (AZURE_*)
# - Workload Identity in Kubernetes cluster
# - Managed Identity
# - Azure CLI auth
# - Developer Azure CLI auth
client_secret = "<>"
# can be found under Azure Active Directory->Properties
tenant_id = "<>"
# Define the optional Azure cloud option e.g. AzureChina, AzureGovernment or AzurePublic. The default is AzurePublic.
# cloud_option = "AzurePublic"
# resource target #1 to collect metrics from
[[inputs.azure_monitor.resource_target]]
# can be found under Overview->Essentials->JSON View in the Azure portal for your application/service
# must start with 'resourceGroups/...' ('/subscriptions/xxxxxxxx-xxxx-xxxx-xxx-xxxxxxxxxxxx'
# must be removed from the beginning of Resource ID property value)
resource_id = "<>"
# the metric names to collect
# leave the array empty to use all metrics available to this resource
metrics = [ "<>", "<>" ]
# metrics aggregation type value to collect
# can be 'Total', 'Count', 'Average', 'Minimum', 'Maximum'
# leave the array empty to collect all aggregation types values for each metric
aggregations = [ "<>", "<>" ]
# resource target #2 to collect metrics from
[[inputs.azure_monitor.resource_target]]
resource_id = "<>"
metrics = [ "<>", "<>" ]
aggregations = [ "<>", "<>" ]
# resource group target #1 to collect metrics from resources under it with resource type
[[inputs.azure_monitor.resource_group_target]]
# the resource group name
resource_group = "<>"
# defines the resources to collect metrics from
[[inputs.azure_monitor.resource_group_target.resource]]
# the resource type
resource_type = "<>"
metrics = [ "<>", "<>" ]
aggregations = [ "<>", "<>" ]
# defines the resources to collect metrics from
[[inputs.azure_monitor.resource_group_target.resource]]
resource_type = "<>"
metrics = [ "<>", "<>" ]
aggregations = [ "<>", "<>" ]
# resource group target #2 to collect metrics from resources under it with resource type
[[inputs.azure_monitor.resource_group_target]]
resource_group = "<>"
[[inputs.azure_monitor.resource_group_target.resource]]
resource_type = "<>"
metrics = [ "<>", "<>" ]
aggregations = [ "<>", "<>" ]
# subscription target #1 to collect metrics from resources under it with resource type
[[inputs.azure_monitor.subscription_target]]
resource_type = "<>"
metrics = [ "<>", "<>" ]
aggregations = [ "<>", "<>" ]
# subscription target #2 to collect metrics from resources under it with resource type
[[inputs.azure_monitor.subscription_target]]
resource_type = "<>"
metrics = [ "<>", "<>" ]
aggregations = [ "<>", "<>" ]
</code></pre>
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"
输入和输出集成示例
Azure 监视器
-
动态资源监控: 使用 Azure 监视器插件根据特定标准(如标签或资源类型)动态收集 Azure 资源的指标。 组织可以自动化加载和卸载资源指标的过程,从而根据资源利用率模式实现更好的性能跟踪和优化。
-
多云监控集成: 使用集中式监控解决方案,将从 Azure 监视器收集的指标与其他云提供商集成。 这使组织能够查看和分析跨多个云部署的性能数据,从而提供资源性能和成本的整体概览,并简化运营。
-
异常检测和警报: 利用通过 Azure 监视器插件收集的指标,结合机器学习算法来检测资源利用率的异常情况。 通过建立基准性能指标并自动警报偏差,组织可以降低风险并在性能问题升级之前解决它们。
-
历史性能分析: 通过将数据馈送到数据仓库解决方案中,使用收集的 Azure 指标进行历史分析。 这使组织能够跟踪长期趋势,从而可以根据历史性能数据进行详细的报告和决策。
SQLite
- 本地监控存储: 配置插件以将指标写入本地 SQLite 数据库文件。 这非常适合不需要设置全面数据库服务器的轻量级部署。
- 嵌入式应用: 将 SQLite 用作嵌入在边缘设备中的应用程序的后端,受益于其基于文件的架构和最低的资源需求。
- 快速设置以进行测试: 利用 SQLite 的易用性,快速为 Telegraf 指标收集设置测试环境,而无需外部数据库服务。
- 自定义模式管理: 如果您需要特定的列类型或索引,请调整表创建模板以预定义您的模式,以确保与您的应用程序的需求兼容。
反馈
感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。
强大性能,无限扩展
收集、组织和处理海量高速数据。 当您将任何数据视为时序数据时,它都会更有价值。 使用 InfluxDB,这是排名第一的、旨在与 Telegraf 一起扩展的时序平台。
查看入门方法