目录
输入和输出集成概述
HTTP 插件允许从指定的 HTTP 端点收集指标,处理各种数据格式和身份验证方法。
Google BigQuery 插件允许 Telegraf 将指标写入 Google Cloud BigQuery,从而为遥测数据启用强大的数据分析功能。
集成详情
HTTP
HTTP 插件从一个或多个 HTTP(S) 端点收集指标,这些端点应具有以受支持的输入数据格式之一格式化的指标。 它还支持来自 secret-stores 的密钥,用于各种身份验证选项,并包括全局支持的配置设置。
Google BigQuery
Telegraf 的 Google BigQuery 插件实现了与 Google Cloud 的 BigQuery 服务的无缝集成,BigQuery 服务是一个流行的数据仓库和分析平台。 此插件有助于将 Telegraf 收集的指标传输到 BigQuery 数据集中,使用户可以更轻松地对其遥测数据执行分析并生成见解。 它需要通过服务帐户或用户凭据进行身份验证,并且旨在处理各种数据类型,从而确保用户在将指标存储在 BigQuery 表中时可以保持指标的完整性和准确性。 配置选项允许围绕数据集规范和处理指标进行自定义,包括管理指标名称中的连字符,BigQuery 的流式插入不支持连字符。 对于利用 BigQuery 的可扩展性和强大的查询功能来分析大量监控数据的组织来说,此插件特别有用。
配置
HTTP
[[inputs.http]]
## One or more URLs from which to read formatted metrics.
urls = [
"http://localhost/metrics",
"http+unix:///run/user/420/podman/podman.sock:/d/v4.0.0/libpod/pods/json"
]
## HTTP method
# method = "GET"
## Optional HTTP headers
# headers = {"X-Special-Header" = "Special-Value"}
## HTTP entity-body to send with POST/PUT requests.
# body = ""
## HTTP Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "identity"
## Optional Bearer token settings to use for the API calls.
## Use either the token itself or the token file if you need a token.
# token = "eyJhbGc...Qssw5c"
# token_file = "/path/to/file"
## Optional HTTP Basic Auth Credentials
# username = "username"
# password = "pa$$word"
## OAuth2 Client Credentials. The options 'client_id', 'client_secret', and 'token_url' are required to use OAuth2.
# client_id = "clientid"
# client_secret = "secret"
# token_url = "https://indentityprovider/oauth2/v1/token"
# scopes = ["urn:opc:idm:__myscopes__"]
## HTTP Proxy support
# use_system_proxy = false
# http_proxy_url = ""
## Optional TLS Config
## Set to true/false to enforce TLS being enabled/disabled. If not set,
## enable TLS only if any of the other options are specified.
# tls_enable =
## Trusted root certificates for server
# tls_ca = "/path/to/cafile"
## Used for TLS client certificate authentication
# tls_cert = "/path/to/certfile"
## Used for TLS client certificate authentication
# tls_key = "/path/to/keyfile"
## Password for the key file if it is encrypted
# tls_key_pwd = ""
## Send the specified TLS server name via SNI
# tls_server_name = "kubernetes.example.com"
## Minimal TLS version to accept by the client
# tls_min_version = "TLS12"
## List of ciphers to accept, by default all secure ciphers will be accepted
## See https://pkg.go.dev/crypto/tls#pkg-constants for supported values.
## Use "all", "secure" and "insecure" to add all support ciphers, secure
## suites or insecure suites respectively.
# tls_cipher_suites = ["secure"]
## Renegotiation method, "never", "once" or "freely"
# tls_renegotiation_method = "never"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Optional Cookie authentication
# cookie_auth_url = "https://localhost/authMe"
# cookie_auth_method = "POST"
# cookie_auth_username = "username"
# cookie_auth_password = "pa$$word"
# cookie_auth_headers = { Content-Type = "application/json", X-MY-HEADER = "hello" }
# cookie_auth_body = '{"username": "user", "password": "pa$$word", "authenticate": "me"}'
## cookie_auth_renewal not set or set to "0" will auth once and never renew the cookie
# cookie_auth_renewal = "5m"
## Amount of time allowed to complete the HTTP request
# timeout = "5s"
## List of success status codes
# success_status_codes = [200]
## Data format to consume.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
# data_format = "influx"
Google BigQuery
# Configuration for Google Cloud BigQuery to send entries
[[outputs.bigquery]]
## Credentials File
credentials_file = "/path/to/service/account/key.json"
## Google Cloud Platform Project
# project = ""
## The namespace for the metric descriptor
dataset = "telegraf"
## Timeout for BigQuery operations.
# timeout = "5s"
## Character to replace hyphens on Metric name
# replace_hyphen_to = "_"
## Write all metrics in a single compact table
# compact_table = ""
输入和输出集成示例
HTTP
- 从本地主机收集指标:该插件可以从 HTTP 端点(如 http://localhost/metrics)获取指标,从而实现轻松的本地监控。
- 使用 Unix 域套接字:您可以使用 http+unix 方案指定从 Unix 域套接字上的服务收集指标,例如 http+unix:///path/to/service.sock:/api/endpoint。
Google BigQuery
-
实时分析仪表板:利用 Google BigQuery 插件将实时指标馈送到 Google Cloud 上托管的自定义分析仪表板中。 这种设置将使团队能够实时可视化性能数据,从而深入了解系统运行状况和使用模式。 通过使用 BigQuery 的查询功能,用户可以轻松创建量身定制的报告和仪表板来满足其特定需求,从而增强决策过程。
-
成本管理和优化分析:利用该插件自动将来自各种服务的成本相关指标发送到 BigQuery。 分析这些数据可以帮助企业识别不必要的费用并优化资源使用。 通过在 BigQuery 中执行聚合和转换查询,组织可以创建准确的预测并有效地管理其云支出。
-
跨团队监控数据协作:使组织内不同的团队能够使用 BigQuery 共享其监控数据。 借助此 Telegraf 插件,团队可以将他们的指标推送到中央 BigQuery 实例,从而促进协作。 这种数据共享方法鼓励最佳实践和跨职能意识,从而共同改进系统性能和可靠性。
-
用于容量规划的历史分析:通过使用 BigQuery 插件,公司可以收集和存储对于容量规划至关重要的历史指标数据。 分析随时间变化的趋势可以帮助预测系统需求并主动扩展基础设施。 组织可以创建时序分析并识别有助于其长期战略决策的模式。
反馈
感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。