webdevops / azure-metrics-exporter

Azure Monitor metrics exporter for Prometheus with dimension support, template engine and ServiceDiscovery
MIT License
118 stars 24 forks source link

Unable to fetch Azure metrics #82

Open Vishnupriya9943 opened 4 months ago

Vishnupriya9943 commented 4 months ago

I am using Azure metrics exporter for fetching azure metrics but I am unable to get my virtual machine metrics while running below config file.

./azure-metrics-exporter sample_vm.yml --log.debug

this is my config file

- job_name: azure-metrics-compute
  scrape_interval: 1m
  metrics_path: /metrics
  params:
    name: ["azure_metric_compute"]
    subscription:
    - xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    filter: ["Microsoft.Compute/virtualMachines"]
    metric:
    - CPU Credits Consumed
    - CPU Credits Remaining
    interval: ["PT15M"]
    timespan: ["PT15M"]
    aggregation:
    - average
  static_configs:
  - targets: ["localhost:8080"]

And i exported my client_id , secret_id, tenant_id.

sample screenshot azure_metrics_exporter

Screenshot from 2024-03-19 18-14-56

Kindly help me to resolve this one, Thanks.

Neurobion commented 3 months ago

@Vishnupriya9943 If I'm not mistaken the utility doesn't expect a file as input parameter. Your sample_vm.yml is designed for a Prometheus instance where you define an external source of metrics.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config

Also your metrics_path is probably not what you want. /metrics context is default prometheus golang metrics which is confirmed by your screenshot with localhost:8080/metrics

Try to get

curl "http://localhost:8080/probe/metrics?subscription=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&resourceType=Microsoft.Compute/virtualMachines&metric=xxxxxxx"