stack/deploy/etc/prometheus/prometheus.yml
2023-05-20 21:41:33 +02:00

83 lines
2.3 KiB
YAML

global:
scrape_interval: 10s
evaluation_interval: 10s
# rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: docker
dockerswarm_sd_configs:
- host: unix:///var/run/docker.sock
role: tasks
relabel_configs:
- source_labels: [__meta_dockerswarm_service_name, __address__]
regex: egommerce_(api-eventbus|api-gateway);(.*):(.*)
action: replace
replacement: '$2:8084'
target_label: __address__
# - source_labels: [__meta_dockerswarm_service_name, __address__]
# regex: egommerce_api-gateway;(.*):(.*)
# action: replace
# replacement: '$1:8084'
# target_label: __address__
# Only keep containers that should be running.
- source_labels: [__meta_dockerswarm_service_label_com_docker_stack_namespace]
regex: egommerce
action: keep
- source_labels: [__meta_dockerswarm_task_desired_state]
regex: running
action: keep
# - source_labels: [__meta_dockerswarm_network_name]
# regex: ingress
# action: keep
- source_labels: [__meta_dockerswarm_service_name]
action: replace
replacement: '$1'
target_label: instance
# - source_labels: [__meta_dockerswarm_task_desired_state]
# regex: running
# action: keep
# - job_name: consul
# consul_sd_configs:
# - server: api-registry:8500
# services:
# - consul
# - basket-server
# - catalog-server
# - identity-svc
# - order-svc
# - pricing-svc
# - consul
# - job_name: rabbitmq
# consul_sd_configs:
# - server: api-registry:8500
# services:
# - api-eventbus
# relabel_configs:
# - source_labels: ['__meta_consul_service_address']
# replacement: '$1:8084'
# target_label: __address__
# - source_labels: ['__meta_consul_service_port']
# replacement: '8084'
# target_label: __meta_consul_service_port
# - job_name: 'api-gateway'
# static_configs:
# - targets: ['api-gateway:8084']
# - job_name: 'api-eventbus'
# static_configs:
# - targets: ['api-eventbus:8084']
# - job_name: 'catalog-svc'
# static_configs:
# - targets: ['catalog-svc:8084']