Azure Monitor 和 Loki 集成

强大的性能和简易的集成,由 Telegraf 提供支持,Telegraf 是 InfluxData 构建的开源数据连接器。

info

对于大规模实时查询,这不是推荐的配置。为了优化查询和压缩、高速摄取和高可用性,您可能需要考虑 Azure Monitor 和 InfluxDB 集成

50 亿+

Telegraf 下载量

#1

时序数据库
来源:DB Engines

10 亿+

InfluxDB 下载量

2,800+

贡献者

目录

强大的性能,无限的扩展

收集、组织和处理海量高速数据。当您将任何数据视为时序数据时,它会更有价值。使用 InfluxDB,第一的时序平台,旨在与 Telegraf 一起扩展。

查看入门方法

输入和输出集成概述

使用 Azure Monitor API 从 Azure 资源收集指标。

Loki 插件允许用户将日志发送到 Loki 进行聚合和查询,从而利用 Loki 高效的存储能力。

集成详情

Azure Monitor

Azure Monitor Telegraf 插件专为使用 Azure Monitor API 从各种 Azure 资源收集指标而设计。用户必须提供特定的凭据,例如 client_idclient_secrettenant_idsubscription_id,以进行身份验证并访问其 Azure 资源。此外,该插件还支持从单个资源以及资源组或订阅收集指标的功能,从而可以根据用户需求灵活且可扩展地收集指标。此插件非常适合利用 Azure 云基础设施的组织,可以深入了解资源在一段时间内的性能和利用率,从而促进云资源的积极管理和优化。

Loki

此 Loki 插件与 Grafana Loki 集成,Grafana Loki 是一个强大的日志聚合系统。通过以与 Loki 兼容的格式发送日志,此插件可以高效地存储和查询日志。每个日志条目都以键值格式结构化,其中键表示字段名称,值表示相应的日志信息。按时间戳对日志进行排序可确保通过 Loki 查询时,日志流保持时间顺序。此插件对密钥的支持使安全管理身份验证参数更加容易,而 HTTP 标头、gzip 编码和 TLS 配置选项增强了日志传输的适应性和安全性,从而满足各种部署需求。

配置

Azure Monitor

# 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>

Loki

[[outputs.loki]]
  ## The domain of Loki
  domain = "https://loki.domain.tld"

  ## Endpoint to write api
  # endpoint = "/loki/api/v1/push"

  ## Connection timeout, defaults to "5s" if not set.
  # timeout = "5s"

  ## Basic auth credential
  # username = "loki"
  # password = "pass"

  ## Additional HTTP headers
  # http_headers = {"X-Scope-OrgID" = "1"}

  ## If the request must be gzip encoded
  # gzip_request = false

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"

  ## Sanitize Tag Names
  ## If true, all tag names will have invalid characters replaced with
  ## underscores that do not match the regex: ^[a-zA-Z_:][a-zA-Z0-9_:]*.
  # sanitize_label_names = false

  ## Metric Name Label
  ## Label to use for the metric name to when sending metrics. If set to an
  ## empty string, this will not add the label. This is NOT suggested as there
  ## is no way to differentiate between multiple metrics.
  # metric_name_label = "__name"

输入和输出集成示例

Azure Monitor

  1. 动态资源监控:使用 Azure Monitor 插件根据特定标准(如标签或资源类型)动态收集 Azure 资源的指标。组织可以自动化加载和卸载资源指标的过程,从而根据资源利用率模式更好地跟踪和优化性能。

  2. 多云监控集成:使用集中式监控解决方案将从 Azure Monitor 收集的指标与其他云提供商集成。这使组织可以查看和分析跨多个云部署的性能数据,从而全面了解资源性能和成本,并简化运营。

  3. 异常检测和警报:结合使用 Azure Monitor 插件收集的指标和机器学习算法,以检测资源利用率中的异常。通过建立基线性能指标并自动警报偏差,组织可以减轻风险并在性能问题升级之前解决它们。

  4. 历史性能分析:通过将数据馈送到数据仓库解决方案中,使用收集的 Azure 指标进行历史分析。这使组织能够跟踪随时间变化的趋势,从而可以基于历史性能数据进行详细的报告和决策。

Loki

  1. 微服务集中式日志记录:利用 Loki 插件收集 Kubernetes 集群中运行的多个微服务的日志。通过将日志定向到集中式 Loki 实例,开发人员可以在一个地方监控、搜索和分析来自所有服务的日志,从而更轻松地进行故障排除和性能监控。此设置简化了运营,并支持对分布式应用程序中的问题做出快速响应。

  2. 实时日志异常检测:将 Loki 与监控工具结合使用,实时分析日志输出中可能指示系统错误或安全威胁的异常模式。在日志流上实施异常检测使团队能够主动识别和响应事件,从而提高系统可靠性并增强安全态势。

  3. 使用 Gzip 压缩增强日志处理:配置 Loki 插件以使用 gzip 压缩进行日志传输。这种方法可以减少带宽使用并提高传输速度,这在网络带宽可能受限的环境中尤其有利。它对于每字节都很重要且性能至关重要的大容量日志记录应用程序特别有用。

  4. 使用自定义标头支持多租户:利用添加自定义 HTTP 标头的功能来隔离多租户应用程序环境中不同租户的日志。通过使用 Loki 插件为每个租户发送不同的标头,运营商可以确保正确的日志管理并符合数据隔离要求,使其成为 SaaS 应用程序的多功能解决方案。

反馈

感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。

强大的性能,无限的扩展

收集、组织和处理海量高速数据。当您将任何数据视为时序数据时,它会更有价值。使用 InfluxDB,第一的时序平台,旨在与 Telegraf 一起扩展。

查看入门方法

相关集成

HTTP 和 InfluxDB 集成

HTTP 插件从一个或多个 HTTP(S) 端点收集指标。它支持各种身份验证方法和数据格式的配置选项。

查看集成

Kafka 和 InfluxDB 集成

此插件从 Kafka 读取消息,并允许基于这些消息创建指标。它支持各种配置,包括不同的 Kafka 设置和消息处理选项。

查看集成

Kinesis 和 InfluxDB 集成

Kinesis 插件允许从 AWS Kinesis 流读取指标。它支持多种输入数据格式,并提供使用 DynamoDB 进行检查点操作的功能,以实现可靠的消息处理。

查看集成