Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API key as url parameter #2

Closed
4xoc opened this issue Aug 19, 2022 · 1 comment
Closed

API key as url parameter #2

4xoc opened this issue Aug 19, 2022 · 1 comment

Comments

@4xoc
Copy link

4xoc commented Aug 19, 2022

The old pure_exporter had the option to set the api token as url parameter which allowed the value to be set via label mapping. As a result, there was only one prometheus scrape job for all arrays and not one job per array as this new version enforces. That's because one can set the parameter in the targets list (see below). Any chance to add url parameter back again? Scaling with more arrays is otherwise tricky and breaks many workflows (like silencing an entire job because of maintenance etc). Here's an example of how we currently use it with the old exporter that unfortunately no longer works.

prometheus.yml

scrape_configs:
  - job_name: 'pure'
    honor_labels: true
    metrics_path: /metrics/flasharray
    scrape_interval: 10s
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_endpoint
      - source_labels: [__pure_apitoken]
        target_label: __param_apitoken
      - source_labels: [__address__]
        target_label: instance
        # trim fqdn to short name
        regex: '^(.+)\.example\.com$'
      - target_label: __address__
        replacement: localhost:9491
    file_sd_configs:
      - files:
        - /etc/prometheus/targets/pure.yml

/etc/prometheus/targets/pure.yml

- targets: [ pure1.example.com ]
  labels:
    __pure_apitoken: aaaa-bbb-ccc-ddd-eee
- targets: [ pure2.example.com ]
  labels:
    __pure_apitoken: aaaa-bbb-ccc-eee-ddd
@genegr
Copy link
Collaborator

genegr commented Oct 4, 2022

I am aware this was a useful option for keeping the Prometheus config file short and readable, but the Prometheus maintainers have requested to remove that possibility in order to get the exporter accepted in the list of available exporters. The main reason, which I cannot disagree with, is that it is not a good practice providing authentication/authorization tokens in the URL.

@genegr genegr closed this as completed Oct 4, 2022
sdodsley added a commit that referenced this issue Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants