Add cAdvisor and Prometheus integration

This commit is contained in:
Thomas Kleinendorst 2025-01-15 13:38:01 +01:00
parent 7c249e978b
commit 89c73cbfa4
3 changed files with 48 additions and 0 deletions

View file

@ -1,4 +1,43 @@
--- ---
- name: Install the container
become: true
community.docker.docker_container:
name: cadvisor
image: "gcr.io/cadvisor/cadvisor:{{ versions.monitoring.cAdvisor }}"
image_name_mismatch: recreate
ports:
- "127.0.0.1:8091:8080/tcp"
mounts:
- source: /
target: /rootfs
read_only: true
type: bind
- source: /var/run
target: /var/run
read_only: true
type: bind
- source: /sys
target: /sys
read_only: true
type: bind
- source: /var/lib/docker/
target: /var/lib/docker
read_only: true
type: bind
- source: /dev/disk/
target: /dev/disk
read_only: true
type: bind
privileged: true
devices:
- /dev/kmsg
restart_policy: always
- name: Include simple-reverse-proxy role
ansible.builtin.include_role:
name: simple-reverse-proxy
vars:
simple_reverse_proxy_internal_port: 8091
simple_reverse_proxy_internal_subdomain: cadvisor
- name: Include the Prometheus role - name: Include the Prometheus role
ansible.builtin.include_role: ansible.builtin.include_role:
name: prometheus.prometheus.prometheus name: prometheus.prometheus.prometheus

View file

@ -14,6 +14,9 @@ prometheus_targets:
postgres: postgres:
- targets: - targets:
- raspberry-pi-1.kleinendorst.info:9187 - raspberry-pi-1.kleinendorst.info:9187
cadvisor:
- targets:
- raspberry-pi-1.kleinendorst.info:8091
prometheus_web_listen_address: 127.0.0.1:9090 prometheus_web_listen_address: 127.0.0.1:9090
prometheus_scrape_configs: prometheus_scrape_configs:
- job_name: "prometheus" - job_name: "prometheus"
@ -32,6 +35,10 @@ prometheus_scrape_configs:
file_sd_configs: file_sd_configs:
- files: - files:
- "{{ prometheus_config_dir }}/file_sd/postgres.yml" - "{{ prometheus_config_dir }}/file_sd/postgres.yml"
- job_name: "cadvisor"
file_sd_configs:
- files:
- "{{ prometheus_config_dir }}/file_sd/cadvisor.yml"
prometheus_alertmanager_config: prometheus_alertmanager_config:
- static_configs: - static_configs:
- targets: - targets:

View file

@ -12,6 +12,8 @@ versions:
# Changelog: https://github.com/immich-app/immich/releases # Changelog: https://github.com/immich-app/immich/releases
immich: v1.124.2 immich: v1.124.2
monitoring: monitoring:
# Releases: https://github.com/google/cadvisor/releases/
cAdvisor: v0.49.2
# Changelog: https://github.com/prometheus/prometheus/blob/main/CHANGELOG.md # Changelog: https://github.com/prometheus/prometheus/blob/main/CHANGELOG.md
# Note that version 3.0.0 was just released, upgrading is probably necessary. # Note that version 3.0.0 was just released, upgrading is probably necessary.
prometheus: 3.0.1 prometheus: 3.0.1