file_sd with params

40 views
Skip to first unread message

Christian Oelsner

unread,
Mar 23, 2023, 5:17:44 PM3/23/23
to Prometheus Users
Hello all,

I am trying to use file_sd with params.
I currently have a scrape job that looks similar to this.

- job_name: 'confluent-cloud'
      scrape_interval: 1m
      scrape_timeout: 20s
      static_configs:
      - targets:
        - api.telemetry.confluent.cloud
      scheme: https
      basic_auth:
        username: username
        password: password
      metrics_path: /v2/metrics/cloud/export
      params:
        "resource.kafka.id":
          - lkc-aaaaa
          - lkc-bbbbb
          - lkc-ccccc
          - lkc-ddddd

The params are my challenge. They are growing rapidly and i now have some 40+ clusters.
I have been searching around for guidance on how to do this with file_sd as this would make my life easier, but alas. I havent been able to decode how to achieve that.
Is it even possible to have a targets.json/yml with params that would result in the same as the job above?

Best regards
Christian Oelsner

Julien Pivotto

unread,
Mar 23, 2023, 5:43:01 PM3/23/23
to Christian Oelsner, Prometheus Users
It is not possible as target.json param only override the first entry and will not allow dots.

Prometheus 2.43 enables scrape_config_file so you can split your scrape
configs into multiple files. Maybe that can be helpful.
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/b3e93bdb-6454-494a-a77a-15fb7d6c627en%40googlegroups.com.


--
Julien Pivotto
@roidelapluie
Reply all
Reply to author
Forward
0 new messages