prometheus.yml.

- You create one or more files that list target groups as objects with
targetsandlabels. - In
prometheus.yml, add afile_sd_configsentry under the appropriatescrape_configsjob and point it at those files (or use a glob to match many files). - Prometheus watches those files and updates its target list when the files change.
prometheus.yml:
*.json or **/*.yaml). Prometheus will merge the discovered target groups from all matched files.
Prometheus watches the configured files and automatically reloads targets when they change. Use globs to split targets across files (per-team or per-environment) and keep your
prometheus.yml small and consistent.
Operational notes
- The
joblabel is commonly set in the file to identify the scrape job, but you can set any labels required for your metrics or alerting rules. - Files may be JSON or YAML; choose the format that best fits your tooling.
- After Prometheus starts (or after the files change), check the Prometheus UI to verify discovered targets appear as expected.
Treat file-based configuration as sensitive: files may contain labels or metadata you don’t want exposed. Secure file permissions and avoid storing credentials in these files.

- File SD is a simple way to import static or externally-provided targets into Prometheus.
- Use JSON/YAML files and reference them via
file_sd_configsinprometheus.yml. - Use globs to manage many files and the Prometheus UI to verify discovery results.