From 9cd5b645b6c3e4c779c26253424787c313132060 Mon Sep 17 00:00:00 2001 From: manu vasconcelos Date: Wed, 15 Feb 2023 20:39:05 -0300 Subject: [PATCH] added cadvisor Cadvisors suggested setup didn't work. I followed this suggestion: https://github.com/google/cadvisor/issues/2838#issuecomment-1248819708 --- docker-compose.yaml | 29 +++++++++++++++++++++++++++++ prometheus.yml | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index 2571641..02e99fb 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -16,3 +16,32 @@ services: - --config.file=/etc/prometheus/prometheus.yml volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro + depends_on: + - cadvisor + # cadvisor: + # image: gcr.io/cadvisor/cadvisor:latest + # container_name: cadvisor + # ports: + # - 8080:8080 + # volumes: + # - /:/rootfs:ro + # - /var/run:/var/run:rw + # - /sys:/sys:ro + # - /var/lib/docker/:/var/lib/docker:ro + + cadvisor: + image: gcr.io/cadvisor/cadvisor:v0.45.0 + container_name: cadvisor + privileged: true + devices: + - /dev/kmsg:/dev/kmsg + ports: + - 8080:8080 + volumes: + - /var/run:/var/run:ro + - /sys:/sys:ro + - /var/lib/docker/:/var/lib/docker:ro + - /var/run/docker.sock:/var/run/docker.sock:ro + - /etc/machine-id:/etc/machine-id:ro + - /var/lib/dbus/machine-id:/var/lib/dbus/machine-id:ro + restart: unless-stopped diff --git a/prometheus.yml b/prometheus.yml index 0cbde7b..05e0b58 100644 --- a/prometheus.yml +++ b/prometheus.yml @@ -15,3 +15,7 @@ scrape_configs: scrape_interval: 5s static_configs: - targets: ['app:5001'] + - job_name: cadvisor + scrape_interval: 5s + static_configs: + - targets: ['cadvisor:8080']