(prometheus) Add in-docker prometheus instance to exfiltrate metrics from the docker-based services

This commit is contained in:
Viktor Lofgren 2024-01-01 17:16:29 +01:00
parent 9f7df59945
commit 116595d218
2 changed files with 27 additions and 4 deletions

View File

@ -8,10 +8,8 @@ x-svc: &service
- logs:/var/log/wmsa - logs:/var/log/wmsa
networks: networks:
- wmsa - wmsa
depends_on: labels:
mariadb: - "__meta_docker_port_private=7000"
condition: service_healthy
x-p1: &partition-1 x-p1: &partition-1
env_file: env_file:
- "run/env/service.env" - "run/env/service.env"
@ -201,6 +199,18 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock:ro" - "/var/run/docker.sock:/var/run/docker.sock:ro"
networks: networks:
- wmsa - wmsa
prometheus:
image: "prom/prometheus"
container_name: "prometheus"
command:
- "--config.file=/etc/prometheus/prometheus.yml"
ports:
- "127.0.0.1:8091:9090"
volumes:
- "./run/prometheus.yml:/etc/prometheus/prometheus.yml"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- wmsa
networks: networks:
wmsa: wmsa:
volumes: volumes:

13
run/prometheus.yml Normal file
View File

@ -0,0 +1,13 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: docker
docker_sd_configs:
- host: unix:///var/run/docker.sock
relabel_configs:
- source_labels:
- '__meta_docker_network_ip'
target_label: '__address__'
replacement: '$1:7000'