Merge pull request #7608 from roidelapluie/exemple

Improve docker swarm configuration exemple
This commit is contained in:
Björn Rabenstein 2020-07-20 15:34:58 +02:00 committed by GitHub
commit eaa522867e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,29 @@
# A example scrape configuration for running Prometheus with
# Docker Swarm.
scrape_configs:
# Make Prometheus scrape itself for metrics.
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
# Create a job for Docker daemons.
#
# This exemple requires Docker daemons to be configured to expose
# Prometheus metrics, as documented here:
# https://docs.docker.com/config/daemon/prometheus/
- job_name: 'docker'
dockerswarm_sd_configs:
- host: unix:///var/run/docker.sock # You can also use http/https to connect to the Docker daemon.
role: nodes
relabel_configs:
# Fetch metrics on port 9323.
- source_labels: [__meta_dockerswarm_node_address]
target_label: __address__
replacement: $1:9323
# Create a job for Docker Swarm containers.
#
# This example works with cadvisor deployed with:
# docker service create --name cadvisor -l prometheus-job=cadvisor
@ -10,18 +34,9 @@
# --mount type=bind,src=/sys,dst=/sys,ro
# --mount type=bind,src=/var/lib/docker,dst=/var/lib/docker,ro
# google/cadvisor -docker_only
scrape_configs:
# Make Prometheus scrape itself for metrics.
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
# Create a job for Docker Swarm containers.
- job_name: 'dockerswarm'
dockerswarm_sd_configs:
- host: http://127.0.0.1:2375
- host: unix:///var/run/docker.sock # You can also use http/https to connect to the Docker daemon.
role: tasks
relabel_configs:
# Only keep containers that should be running.