file_sd_configs (with a YAML/JSON file) and static_configs (with inline list of targets) are identical format. What you've written looks valid; we can't really help unless you describe what "having some issues" actually means, and how it's different from what you did with static_configs.
Note that simply adding a target label called "__pure_apitoken" won't make any difference to how the scraping is done; it certainly won't pass any token to the target in the scrape. This is true for both static_configs and file_sd_configs. So I suggest you: 1. Show your full (working) config with static_configs 2. Show your non-working config with file_sd_configs and it will probably be clear what you've done differently in the second case. On Monday, 11 April 2022 at 23:17:11 UTC+1 [email protected] wrote: > This is basically going to be set up as > > file_sd_configs: > - files: [ '/path/to/file.json' ] > > And I will comment out the static config. But I'm having some issues with > the json file. > > On Monday, April 11, 2022 at 5:02:16 PM UTC-5 Andrew Meyer wrote: > >> So this pure storage. Here is more details: >> >> [ >> { >> "targets": [ "1.2.3.4", "2.3.4.5" ], >> "labels": { >> "env": "prod", >> "__pure_apitoken: API KEY, >> "job": "pure_flashblade" >> } >> } >> ] >> >> On Monday, April 11, 2022 at 3:55:02 PM UTC-5 Brian Candler wrote: >> >>> 1. How do you need to provide the API token - as a HTTP header (if so >>> what)? As a URL query parameter? Something else? >>> >>> 2. What do you mean by "set up dynamic targets"? What service discovery >>> mechanism are you using? >>> >>> static_configs and file_sd_configs are the same, when it comes to >>> setting labels and targets. >>> >>> 3. What relabelling configs do you have? That "__storage_apitoken" >>> label must be rewritten to have some effect. Otherwise, labels which begin >>> with double underscore are thrown away >>> <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config> >>> . >>> >>> 4. Aside: you shouldn't set "job" as a target label. This is added >>> automatically by the scrape job itself. >>> >>> On Monday, 11 April 2022 at 21:34:00 UTC+1 [email protected] wrote: >>> >>>> I am trying to set up dynamic targets for our storage environment. I >>>> am able to access it using the static_configs but it requires an API token. >>>> >>>> This is what I have currently configured but had to revert back to >>>> static_configs. It wouldn't read the API token at all. >>>> >>>> [ >>>> { >>>> "targets": [ "1.2.3.4", "2.3.45" ], >>>> "labels": { >>>> "env": "prod", >>>> "__storage_apitoken": "something-something-something-something", >>>> "job": "storage_exporter" >>>> } >>>> } >>>> ] >>>> >>> -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/b3dcd387-7682-4afc-a400-75b478b55784n%40googlegroups.com.

