Reputation: 5862
For a particular job in Prometheus, it seems like the typical config is something like this:
static_configs:
- targets: ['localhost:9090']
But in the case where I want a dynamic list of hosts, what would be the approach there? I was looking at scrape_config
but that doesn't seem to accomplish what I'm after (unless I'm misreading?).
Thank you in advance!
Upvotes: 20
Views: 42389
Reputation: 353
There are several ways of providing dynamic targets to your Prometheus. Please refer the link here
Some of them are:
I think what you require is file_sd_config. file_sd_config
is a more generic way to configure static targets. You may provide the targets in a yaml or json format. Please follow the link for detailed information.
Upvotes: 14
Reputation: 34142
If one of the provided service discovery mechanisms doesn't already do what you need, you can use file_sd_configs to provide targets on the fly.
Upvotes: 11