From 0596bae703a8e1dfab81938412aa4482cc342b7f Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 6 Aug 2022 23:17:17 +0300 Subject: [PATCH] docs/sd_configs.md: add docs for static_configs --- docs/sd_configs.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/sd_configs.md b/docs/sd_configs.md index 178ca4d88..9d5fa5472 100644 --- a/docs/sd_configs.md +++ b/docs/sd_configs.md @@ -19,7 +19,7 @@ sort: 24 * `http_sd_configs` is for discovering and scraping targerts provided by external http-based service discovery. See [these docs](#http_sd_configs). * `kubernetes_sd_configs` is for discovering and scraping [Kubernetes](https://kubernetes.io/) targets. See [these docs](#kubernetes_sd_configs). * `openstack_sd_configs` is for discovering and scraping OpenStack targets. See [these docs](#openstack_sd_configs). -* `static_configs` is for scraping statically defined targets. See [these docs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config). +* `static_configs` is for scraping statically defined targets. See [these docs](#static_configs). * `yandexcloud_sd_configs` is for discoverying and scraping [Yandex Cloud](https://cloud.yandex.com/en/) targets. See [these docs](#yandexcloud_sd_configs). Note that the `refresh_interval` option isn't supported for these scrape configs. Use the corresponding `-promscrape.*CheckInterval` @@ -962,6 +962,36 @@ One of the following `role` types can be configured to discover targets: * `__meta_openstack_user_id`: the user account owning the tenant. +## static_configs + +A static config allows specifying a list of targets and a common label set for them. + +Configuration example: + +```yaml +scrape_configs: +- job_name: static + static_configs: + + # targets must contain a list of `host:port` targets to scrape. + # The `http://host:port/metrics` endpoint is scraped per each configured traget then. + # The `http` scheme can be changed to `https` by setting it via `scheme` field at `scrape_config` level. + # The `/metrics` path can be changed to arbitrary path via `metrics_path` field at `scrape_config` level. + # See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config . + # + # Alternatively the scheme and path can be changed via `relabel_configs` section at `scrape_config` level. + # See https://docs.victoriametrics.com/vmagent.html#relabeling . + - targets: + - "vmsingle1:8428" + - "vmsingleN:8428" + + # labels is an optional labels to add to all the targets. + # labels: + # : "" + # ... + # : "" +``` + ## yandexcloud_sd_configs [Yandex Cloud](https://cloud.yandex.com/en/) SD configurations allow retrieving scrape targets from accessible folders.