gm08
gm08

Reputation: 29

Prometheus - Scraping metrics from different endpoints inside an Azure VM

I have Prometheus running inside a Kubernetes cluster in Azure, and I'm trying to use it to also monitor a few VMs inside the same resource-group.

I have setup Azure SD for the VMs, and it's scanning them correctly, but the point is that in these VMs there are more than 1 service exposing metrics in different ports.

Is there a way to tell Prometheus to scan multiple ports under the azure_service_discovery job? Or at least have these metrics aggregated, so Prometheus can scrape them from one single port?

The job definition that I'm using is:

    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

Upvotes: 0

Views: 1169

Answers (1)

Marc ABOUCHACRA
Marc ABOUCHACRA

Reputation: 3463

You can't have two different ports in the same sd config.
However you can :

  • Either have multiple jobs with different azure_sd_configs. This way you can have different configuration for each job (drop some targets, customize sample limit, etc)
- 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
    ...
  • Or have multiple azure_sd_config for a specific job. In that case (the second one), all of your exporters will be regrouped in the same job, thus they will share the same configuration (sample_limit, scrape_timeout, ...)
- job_name: azure_exporters
  sample_limit: 5000
  azure_sd_configs:
  - port: 9100
    ...
  - port: 9800
    ...

Upvotes: 1

Related Questions