Dynamically add targets to a Prometheus configuration
There are several ways of providing dynamic targets to your Prometheus. Please refer the link here
Some of them are:
- azure_sd_config (for AzureVM metrics)
- consul_sd_config (for Consul's Catalog API)
- dns_sd_config (DNS-based service discovery)
- ec2_sd_config (for AWS EC2 instances)
- openstack_sd_config (for Openstack Nova instances)
- file_sd_config (file-based service discovery)
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.
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.