global: scrape_interval: 15s evaluation_interval: 15s rule_files: - "/etc/prometheus/rules/*.yml" alerting: alertmanagers: - static_configs: - targets: ['alertmanager:9093'] scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] - job_name: 'docker-services' dockerswarm_sd_configs: - host: unix:///var/run/docker.sock role: tasks relabel_configs: # Scrape only containers that have a prometheus.scrape=true label - source_labels: [__meta_dockerswarm_task_label_prometheus_scrape] action: keep regex: true # Use the container name as the instance label - source_labels: [__meta_dockerswarm_task_desired_state, __meta_dockerswarm_task_name] action: replace target_label: instance regex: 'running;(.+)' # Allow overriding the port - source_labels: [__meta_dockerswarm_task_label_prometheus_port] action: replace target_label: __address__ regex: '(.+)' replacement: '${1}'