From ecdd57e13b6c9ee9267bd7b94c92ba70780e7b1b Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 5 Aug 2022 19:16:54 +0300 Subject: [PATCH] docs/sd_configs.md: document file_sd_configs --- docs/sd_configs.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/sd_configs.md b/docs/sd_configs.md index 9eabd12c3..64558715a 100644 --- a/docs/sd_configs.md +++ b/docs/sd_configs.md @@ -14,7 +14,7 @@ sort: 24 * `dockerswarm_sd_configs` is for discovering and scraping [Docker Swarm](https://docs.docker.com/engine/swarm/) targets. See [these docs](#dockerswarm_sd_configs). * `ec2_sd_configs` is for discovering and scraping [Amazon EC2](https://aws.amazon.com/ec2/) targets. See [these docs](#ec2_sd_configs). * `eureka_sd_configs` is for discovering and scraping targets registered in [Netflix Eureka](https://github.com/Netflix/eureka). See [these docs](#eureka_sd_configs). -* `file_sd_configs` is for scraping targets defined in external files (aka file-based service discovery). See [these docs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config). +* `file_sd_configs` is for scraping targets defined in external files (aka file-based service discovery). See [these docs](#file_sd_configs). * `gce_sd_configs` is for discovering and scraping Google Compute Engine (GCE) targets. See [gce_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#gce_sd_config). `vmagent` provides the following additional functionality for `gce_sd_config`: * if `project` arg is missing then `vmagent` uses the project for the instance where it runs; * if `zone` arg is missing then `vmagent` uses the zone for the instance where it runs; @@ -509,6 +509,43 @@ scrape_configs: # See https://docs.victoriametrics.com/sd_configs.html#http-api-client-options ``` +## file_sd_configs + +File-based service discovery reads a set of files containing a list of targets to scrape. +Scrape targets are automatically updated when the underlying files are changed. +Files may be provided in YAML or JSON format. Files must contain a list of static configs in the following format: + +* JSON: + + ```json + [ + { + "targets": ["", ... ], + "labels": { + "": "", + ..., + } + }, + ... + ] + ``` + +* YAML: + + ```yaml + - targets: ["", ... ] + labels: + : + ... + ... + ``` + +Each target has a meta label `__meta_filepath` during the [relabeling](https://docs.victoriametrics.com/vmagent.html#relabeling) phase. +Its value is set to the filepath from which the target was extracted. + +See the [list of integrations](https://prometheus.io/docs/operating/integrations/#file-service-discovery) with `file_sd_configs`. + + ## yandexcloud_sd_configs [Yandex Cloud](https://cloud.yandex.com/en/) SD configurations allow retrieving scrape targets from accessible folders.