我们是否需要 Azure Monitor 中的 Prometheus 指标?

问题描述

Microsoft article 讨论如何使用 Azure Monitor 来抓取 Prometheus 指标。此问题的范围仅限于 K8 集群监控(不是部署在其上的工作负载/应用程序)。根据我的理解,即使是 Prometheus 也使用代理(也称为导出器)来发布 K8 API 服务器公开的指标(通常是 /metrics 端点),然后 Prometheus 通过这些端点抓取指标。

容器的 Azure 监视器也做同样的事情(从 API 服务器收集),甚至更多。它提供了非常详尽的list of metrics

我的问题是:除非我正在查看应用程序/工作负载集成(或 Prometheus 格式),否则我是否遗漏了任何东西,我只使用 Azure Monitor 来处理容器,并没有真正抓取我的 AKS 集群/节点/pods/api 的 Prometheus 指标服务器等?

解决方法

不,如果需要,只收集集群指标完全没问题。

在“prometheus-data-collection-settings”中,将 monitor_kubernetes_pods 设置为 false。

prometheus-data-collection-settings: |- 
[prometheus_data_collection_settings.cluster] 
interval = "1m"
kubernetes_services = ["http://my-service-dns.my-namespace:9102/metrics"]
monitor_kubernetes_pods = false 

请记住,只有当您关心使用 Prometheus 端点获取指标时,所有这些讨论才有意义;通常,AKS 已自行发出指标,您可以在 Azure Monitor 中查看。