From 96747629c2eed20770201bc22adb885dfcb93898 Mon Sep 17 00:00:00 2001 From: Vika Date: Fri, 5 Aug 2022 13:20:21 +0000 Subject: [PATCH] update wiki pages --- CHANGELOG.md | 1 + sd_configs.md | 127 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 124 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a40348..0de765f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add service discovery for [Yandex Cloud](https://cloud.yandex.com/en/). See [these docs](https://docs.victoriametrics.com/sd_configs.html#yandexcloud_sd_configs) and [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1386). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): allow stale responses from Consul service discovery (aka [consul_sd_configs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#consul_sd_config)) by default in the same way as Prometheus does. This should reduce load on Consul when discovering big number of targets. Stale responses can be disabled by specifying `allow_stale: false` option in `consul_sd_config`. +* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): [dockerswarm_sd_configs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#dockerswarm_sd_config): properly set `__meta_dockerswarm_container_label_*` labels instead of `__meta_dockerswarm_task_label_*` labels as Prometheus does. See [this issue](https://github.com/prometheus/prometheus/issues/9187). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): set `up` metric to `0` for partial scrapes in [stream parsing mode](https://docs.victoriametrics.com/vmagent.html#stream-parsing-mode). Previously the `up` metric was set to `1` when at least a single metric has been scraped before the error. This aligns the behaviour of `vmselect` with Prometheus. * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): restart all the scrape jobs during [config reload](https://docs.victoriametrics.com/vmagent.html#configuration-update) after `global` section is changed inside `-promscrape.config`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2884). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): properly assume role with AWS ECS credentials. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2875). Thanks to @transacid for [the fix](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2876). diff --git a/sd_configs.md b/sd_configs.md index d52c099..ba395c3 100644 --- a/sd_configs.md +++ b/sd_configs.md @@ -10,8 +10,8 @@ sort: 24 * `consul_sd_configs` is for discovering and scraping targets registered in [Consul](https://www.consul.io/). See [these docs](#consul_sd_configs). * `digitalocean_sd_configs` is for discovering and scraping targerts registered in [DigitalOcean](https://www.digitalocean.com/). See [these docs](#digitalocean_sd_configs). * `dns_sd_configs` is for discovering and scraping targets from [DNS](https://it.wikipedia.org/wiki/Domain_Name_System) records (SRV, A and AAAA). See [these docs](#dns_sd_configs). -* `docker_sd_configs` is for discovering and scraping Docker targets. See [these docs](#docker_sd_configs). -* `dockerswarm_sd_configs` is for discovering and scraping Docker Swarm targets. See [dockerswarm_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#dockerswarm_sd_config). +* `docker_sd_configs` is for discovering and scraping [Docker](https://www.docker.com/) targets. See [these docs](#docker_sd_configs). +* `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 targets. See [ec2_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#ec2_sd_config). `vmagent` doesn't support the `profile` config param yet. * `eureka_sd_configs` is for discovering and scraping targets registered in [Netflix Eureka](https://github.com/Netflix/eureka). See [eureka_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#eureka_sd_config). * `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). @@ -256,8 +256,7 @@ scrape_configs: # host must contain the address of the Docker daemon. - host: "..." - # port is an optional port to scrape metrics from, when `role` is nodes, - # and for discovered tasks and services that don't have published ports. + # port is an optional port to scrape metrics from. # By default port 80 is used. # port: ... @@ -275,6 +274,126 @@ scrape_configs: # See https://docs.victoriametrics.com/sd_configs.html#http-api-client-options ``` +## dockerswarm_sd_configs + +Docker Swarm SD configurations allow retrieving scrape targets from [Docker Swarm engine](https://docs.docker.com/engine/swarm/). + +One of the following roles can be configured to discover targets: + +* `role: services` + + The `services` role discovers all Swarm services and exposes their ports as targets. + For each published port of a service, a single target is generated. If a service has no published ports, + a target per service is created using the port parameter defined in the SD configuration. + + Available meta labels for `role: services`: + + * `__meta_dockerswarm_service_id`: the id of the service + * `__meta_dockerswarm_service_name`: the name of the service + * `__meta_dockerswarm_service_mode`: the mode of the service + * `__meta_dockerswarm_service_endpoint_port_name`: the name of the endpoint port, if available + * `__meta_dockerswarm_service_endpoint_port_publish_mode`: the publish mode of the endpoint port + * `__meta_dockerswarm_service_label_`: each label of the service + * `__meta_dockerswarm_service_task_container_hostname`: the container hostname of the target, if available + * `__meta_dockerswarm_service_task_container_image`: the container image of the target + * `__meta_dockerswarm_service_updating_status`: the status of the service, if available + * `__meta_dockerswarm_network_id`: the ID of the network + * `__meta_dockerswarm_network_name`: the name of the network + * `__meta_dockerswarm_network_ingress`: whether the network is ingress + * `__meta_dockerswarm_network_internal`: whether the network is internal + * `__meta_dockerswarm_network_label_`: each label of the network + * `__meta_dockerswarm_network_scope`: the scope of the network + +* `role: tasks` + + The `tasks` role discovers all Swarm tasks and exposes their ports as targets. + For each published port of a task, a single target is generated. If a task has no published ports, + a target per task is created using the port parameter defined in the SD configuration. + + Available meta labels for `role: tasks`: + + * `__meta_dockerswarm_container_label_`: each label of the container + * `__meta_dockerswarm_task_id`: the id of the task + * `__meta_dockerswarm_task_container_id`: the container id of the task + * `__meta_dockerswarm_task_desired_state`: the desired state of the task + * `__meta_dockerswarm_task_slot`: the slot of the task + * `__meta_dockerswarm_task_state`: the state of the task + * `__meta_dockerswarm_task_port_publish_mode`: the publish mode of the task port + * `__meta_dockerswarm_service_id`: the id of the service + * `__meta_dockerswarm_service_name`: the name of the service + * `__meta_dockerswarm_service_mode`: the mode of the service + * `__meta_dockerswarm_service_label_`: each label of the service + * `__meta_dockerswarm_network_id`: the ID of the network + * `__meta_dockerswarm_network_name`: the name of the network + * `__meta_dockerswarm_network_ingress`: whether the network is ingress + * `__meta_dockerswarm_network_internal`: whether the network is internal + * `__meta_dockerswarm_network_label_`: each label of the network + * `__meta_dockerswarm_network_label`: each label of the network + * `__meta_dockerswarm_network_scope`: the scope of the network + * `__meta_dockerswarm_node_id`: the ID of the node + * `__meta_dockerswarm_node_hostname`: the hostname of the node + * `__meta_dockerswarm_node_address`: the address of the node + * `__meta_dockerswarm_node_availability`: the availability of the node + * `__meta_dockerswarm_node_label_`: each label of the node + * `__meta_dockerswarm_node_platform_architecture`: the architecture of the node + * `__meta_dockerswarm_node_platform_os`: the operating system of the node + * `__meta_dockerswarm_node_role`: the role of the node + * `__meta_dockerswarm_node_status`: the status of the node + + The `__meta_dockerswarm_network_*` meta labels are not populated for ports which are published with `mode=host`. + +* `role: nodes` + + The `nodes` role is used to discover Swarm nodes. + + Available meta labels for `role: nodes`: + + * `__meta_dockerswarm_node_address`: the address of the node + * `__meta_dockerswarm_node_availability`: the availability of the node + * `__meta_dockerswarm_node_engine_version`: the version of the node engine + * `__meta_dockerswarm_node_hostname`: the hostname of the node + * `__meta_dockerswarm_node_id`: the ID of the node + * `__meta_dockerswarm_node_label_`: each label of the node + * `__meta_dockerswarm_node_manager_address`: the address of the manager component of the node + * `__meta_dockerswarm_node_manager_leader`: the leadership status of the manager component of the node (true or false) + * `__meta_dockerswarm_node_manager_reachability`: the reachability of the manager component of the node + * `__meta_dockerswarm_node_platform_architecture`: the architecture of the node + * `__meta_dockerswarm_node_platform_os`: the operating system of the node + * `__meta_dockerswarm_node_role`: the role of the node + * `__meta_dockerswarm_node_status`: the status of the node + + +Configuration example: + +```yaml +scrape_configs: +- job_name: dockerswarm + dockerswarm_sd_configs: + + # host must contain the address of the Docker daemon. + - host: "..." + + # role must contain `services`, `tasks` or `nodes` as described above. + role: ... + + # port is an optional port to scrape metrics from, when `role` is nodes, and for discovered + # tasks and services that don't have published ports. + # By default port 80 is used. + # port: ... + + # filters is an optional filters to limit the discovery process to a subset of available resources. + # The available filters are listed in the upstream documentation: + # Services: https://docs.docker.com/engine/api/v1.40/#operation/ServiceList + # Tasks: https://docs.docker.com/engine/api/v1.40/#operation/TaskList + # Nodes: https://docs.docker.com/engine/api/v1.40/#operation/NodeList + # filters: + # - name: "..." + # values: ["...", "..."] + + # Additional HTTP API client options can be specified here. + # See https://docs.victoriametrics.com/sd_configs.html#http-api-client-options +``` + ## yandexcloud_sd_configs [Yandex Cloud](https://cloud.yandex.com/en/) SD configurations allow retrieving scrape targets from accessible folders.