Prometheus -从Azure VM内的不同端点抓取指标



我有Prometheus运行在Azure的Kubernetes集群中,我试图用它来监控同一资源组内的几个虚拟机。

我已经为虚拟机设置了Azure SD,它正在正确扫描它们,但关键是在这些虚拟机中,在不同的端口有超过1个服务暴露指标。

是否有办法告诉普罗米修斯扫描多个端口下的azure_service_discovery作业?或者至少将这些参数聚合起来,这样普罗米修斯就可以从一个端口抓取它们?

我使用的工作定义是:

azure_sd_configs:
- authentication_method: "OAuth"
subscription_id: AZURE_SUBSCRIPTION_ID
tenant_id: AZURE_TENANT_ID
client_id: AZURE_CLIENT_ID
client_secret: AZURE_CLIENT_SECRET
port: 9100
refresh_interval: 300s

在同一个sd配置中不能有两个不同的端口。
但是你可以:

  • 具有不同azure_sd_configs的多个作业。这样,您可以为每个作业配置不同的配置(删除一些目标,自定义样本限制等)
- job_name: azure_exporters_a
sample_limit: 1000
azure_sd_configs:
- port: 9100
...
- job_name: azure_exporters_b
sample_limit: 5000
azure_sd_configs:
- port: 9800
...
  • 或者有多个azure_sd_config用于特定的作业。在这种情况下(第二种情况),所有导出器将在同一作业中重新分组,因此它们将共享相同的配置(sample_limit, scrape_timeout,…)
- job_name: azure_exporters
sample_limit: 5000
azure_sd_configs:
- port: 9100
...
- port: 9800
...

最新更新