Prometheus - 从 Azure VM 内的不同端点抓取指标
Prometheus - Scraping metrics from different endpoints inside an Azure VM
我在 Azure 的 Kubernetes 集群中安装了 Prometheus 运行,我正尝试使用它来监控同一资源组中的一些虚拟机。
我已经为 VM 设置了 Azure SD,它正在正确扫描它们,但关键是在这些 VM 中,不同端口中有超过 1 个服务公开指标。
有没有办法告诉Prometheus在azure_service_discovery作业下扫描多个端口?
或者至少汇总这些指标,以便 Prometheus 可以从一个端口抓取它们?
我使用的作业定义是:
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
...
我在 Azure 的 Kubernetes 集群中安装了 Prometheus 运行,我正尝试使用它来监控同一资源组中的一些虚拟机。
我已经为 VM 设置了 Azure SD,它正在正确扫描它们,但关键是在这些 VM 中,不同端口中有超过 1 个服务公开指标。
有没有办法告诉Prometheus在azure_service_discovery作业下扫描多个端口? 或者至少汇总这些指标,以便 Prometheus 可以从一个端口抓取它们?
我使用的作业定义是:
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
...