infrastructure/ansible/plays/services/metric-export/docker-compose.yaml

121 lines
3.3 KiB
YAML

version: "3.4"
services:
prometheus:
image: prom/prometheus:latest
restart: unless-stopped
command:
- '--config.file=/etc/prometheus/prometheus.yml'
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro,Z
- prom_data:/prometheus
- label_discovery:/label_discovery:ro
labels:
- "traefik.enable=false"
depends_on:
- prometheus-docker-sd
- cadvisor
- node-exporter
extra_hosts:
- host.docker.internal:host-gateway
networks:
- default # send
- backend
- metrics
prometheus-docker-sd:
image: registry.tobiasmanske.de/prometheus-docker-sd:latest
restart: unless-stopped
privileged: true
networks:
- backend
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro,Z
- label_discovery:/prometheus-docker-sd:rw
logging: # this service generates a HUGE amout of logs.
driver: "none"
node-exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: "{{ inventory_hostname | replace('.', '-') }}-node-exporter"
privileged: true
labels:
- "prometheus-scrape.enabled=true"
- "prometheus-scrape.port=9100"
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- /:/host:ro,rslave
- /run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
command:
- '--path.rootfs=/host'
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.ignored-mount-points'
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
- '--collector.systemd'
networks:
- backend
restart: unless-stopped
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: "{{ inventory_hostname | replace('.', '-') }}-cadvisor"
privileged: true
labels:
- "prometheus-scrape.enabled=true"
- "prometheus-scrape.port=8080"
command:
- "-docker_only=true"
- "-housekeeping_interval=10s"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
networks:
- backend
restart: unless-stopped
smokeping_prober:
image: quay.io/superq/smokeping-prober@sha256:25d07dfc1d7e47d7bf8305c7c813a030fc6b03959da596ab93f40ae4d49b63a1 # latest @ 2024-01-10
restart: unless-stopped
labels:
- "prometheus-scrape.enabled=true"
- "prometheus-scrape.port=9374"
command:
- "-i" # interval
- "5s"
- "google.com"
- "ipv6.google.com"
- "discord.com"
- "wikipedia.com"
promtail:
image: grafana/promtail:latest
security_opt:
- label:disable
restart: unless-stopped
volumes:
- ./promtail.yml:/etc/promtail/config.yml:ro
- /var/log:/var/log:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock
command: -config.file=/etc/promtail/config.yml
labels:
- "prometheus-scrape.enabled=true"
- "prometheus-scrape.port=8080"
networks:
- default # send
- backend
- metrics
volumes:
prom_data:
label_discovery:
networks:
backend:
internal: true
metrics:
external: true