cadvisor
change
commit c2df59b2e99d2b069c7c463848c88c3c5f84fea7
author Alpha Chen <alpha@kejadlen.dev>
date
parent 56b40374
diff --git a/lotus-land-story/grafana.yml b/lotus-land-story/grafana.yml
index 5c09f36..0d03ae4 100644
--- a/lotus-land-story/grafana.yml
+++ b/lotus-land-story/grafana.yml
@@ -2,6 +2,8 @@
   hosts: lotus-land-story
   vars_files:
     - vars.yml
+  vars:
+    version: 9.2.15
   tasks:
 
     - name: Create Grafana dir
@@ -68,7 +70,7 @@
         # recreate: true
         # restart: true
         name: grafana
-        image: grafana/grafana-oss:9.2.15
+        image: grafana/grafana-oss:{{ version }}
         # ports:
         #   - "3000:3000"
         volumes:
diff --git a/lotus-land-story/prometheus.yml b/lotus-land-story/prometheus.yml
index c712986..d0aaa93 100644
--- a/lotus-land-story/prometheus.yml
+++ b/lotus-land-story/prometheus.yml
@@ -2,6 +2,9 @@
   hosts: lotus-land-story
   vars_files:
     - vars.yml
+  vars:
+    prometheus_version: v2.43.0
+    cadvisor_version: v0.49.1
   tasks:
 
     - name: Install host exporters
@@ -54,10 +57,8 @@
 
     - name: Run Prometheus
       community.docker.docker_container:
-        # recreate: true
-        # restart: true
         name: prometheus
-        image: prom/prometheus:v2.43.0
+        image: prom/prometheus:{{ prometheus_version }}
         command:
           - --config.file=/etc/prometheus/prometheus.yml
           - --storage.tsdb.retention.size=5GB
@@ -74,4 +75,18 @@
         etc_hosts:
           host.docker.internal: host-gateway
 
+    - name: Run cAdvisor
+      community.docker.docker_container:
+        name: cadvisor
+        image: gcr.io/cadvisor/cadvisor:{{ cadvisor_version }}
+        restart: true
+        volumes:
+          - /:/rootfs:ro
+          - /var/run:/var/run:rw
+          - /sys:/sys:ro
+          - /var/lib/docker/:/var/lib/docker:ro
+        restart_policy: unless-stopped
+        networks:
+          - name: lotus_land_story
+
 # vim: ft=yaml.ansible
diff --git a/lotus-land-story/templates/Caddyfile b/lotus-land-story/templates/Caddyfile
index ccc5501..cfded0f 100644
--- a/lotus-land-story/templates/Caddyfile
+++ b/lotus-land-story/templates/Caddyfile
@@ -133,10 +133,6 @@ docs.kejadlen.dev {
 	}
 }
 
-logs.kejadlen.dev
-	reverse_proxy parseable:8000
-}
-
 hey.kejadlen.dev
 	reverse_proxy gotosocial:8080
 
@@ -145,4 +141,18 @@ hey.kejadlen.dev
 	}
 }
 
+cadvisor.kejadlen.dev {
+	forward_auth authelia:9091 {
+		uri /api/verify?rd=https://auth.{{ domain }}
+		copy_headers Remote-User
+
+		# This import needs to be included if you're relying on a trusted proxies configuration.
+		import trusted_proxy_list
+	}
+
+	reverse_proxy cadvisor:8080 {
+		import trusted_proxy_list
+	}
+}
+
 # vim: ts=4
diff --git a/lotus-land-story/templates/prometheus.yml b/lotus-land-story/templates/prometheus.yml
index dd5740b..83be7f4 100644
--- a/lotus-land-story/templates/prometheus.yml
+++ b/lotus-land-story/templates/prometheus.yml
@@ -78,3 +78,9 @@ scrape_configs:
       password: {{ prometheus.gotosocial.password }}
     static_configs:
       - targets: ['gotosocial:8080']
+
+  - job_name: cadvisor
+    scrape_interval: 5s
+    static_configs:
+    - targets:
+      - cadvisor:8080