BuuRoCk
BuuRoCk

Reputation: 79

Prometheus metrics_path gets encoded

URL:localhost:15672/api/queues?columns=name,messages

Result: localhost:15672/api/queues%3Fcolumns=name,messages

Prometheus the '?' gets encoded to '%3F' and therefore the request fails

Can you write the result?

    static_configs:
  - targets: ['localhost:15672']
metrics_path: '/api/queues?columns=name,messages'

Upvotes: 2

Views: 2139

Answers (2)

Rouan van der Ende
Rouan van der Ende

Reputation: 97

This should work better for you:

- job_name: samplejob
  metrics_path: /api/queues
  params:
    columns: [name,messages]
  static_configs:
    - targets:
      - localhost:15672

Documentation and examples can be found here: https://prometheus.io/docs/guides/multi-target-exporter/#querying-multi-target-exporters-with-prometheus

Upvotes: 0

Michael Doubez
Michael Doubez

Reputation: 6873

You have to use the params configuration of the scrape config.

# Optional HTTP URL parameters.
params:
  [ <string>: [<string>, ...] ]

In your case:

static_configs:
- targets: ['localhost:15672']
  metrics_path: '/api/queues'
  params:
     columns:'name,messages'

Upvotes: 4

Related Questions