From 81c86ca1f3d770f79e1a42d15578e02499c3e0a9 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Mon, 26 Feb 2024 17:05:32 +0000 Subject: [PATCH] Fix hddtemp, add Homepage enrichment --- roles/stats/defaults/main.yml | 6 ++++++ roles/stats/tasks/exporters.yml | 16 ++++++++++++++++ roles/stats/tasks/grafana.yml | 5 +++++ roles/stats/tasks/prometheus.yml | 7 +++++++ 4 files changed, 34 insertions(+) diff --git a/roles/stats/defaults/main.yml b/roles/stats/defaults/main.yml index 48ad89ba..b0901a02 100644 --- a/roles/stats/defaults/main.yml +++ b/roles/stats/defaults/main.yml @@ -17,6 +17,7 @@ stats_telegraf_port: "9273" stats_telegraf_influxdb_port: "8086" stats_prometheus_smartctl_port: "9902" stats_speedtest_exporter_port: "9798" +stats_hddtemp_port: "7634" stats_prometheus_hostname: "prometheus" stats_grafana_port: "3000" stats_grafana_hostname: "grafana" @@ -37,11 +38,16 @@ stats_smartctl_docker_image_version: "latest" stats_speedtest_container_name: "stats-speedtest" stats_speedtest_docker_image_name: "miguelndecarvalho/speedtest-exporter" stats_speedtest_docker_image_version: "latest" +stats_hddtemp_docker_container_name: "stats-hddtemp" +stats_hddtemp_docker_image_name: "modem7/hddtemp-docker" +stats_hddtemp_docker_image_tag: "latest" + # specs stats_telegraf_memory: 1g stats_prometheus_memory: 1g stats_prometheus_smartctl_memory: 1g +stats_hddtemp_memory: 128m stats_speedtest_exporter_memory: 256m stats_grafana_memory: 1g diff --git a/roles/stats/tasks/exporters.yml b/roles/stats/tasks/exporters.yml index aa86760c..febd12ad 100644 --- a/roles/stats/tasks/exporters.yml +++ b/roles/stats/tasks/exporters.yml @@ -12,6 +12,22 @@ restart_policy: unless-stopped memory: "{{ stats_prometheus_smartctl_memory }}" + - name: hddtemp Docker Container + community.docker.docker_container: + name: "{{ stats_hddtemp_docker_container_name }}" + image: "{{ stats_hddtemp_docker_image_name }}:{{ stats_hddtemp_docker_image_tag }}" + pull: true + privileged: true + ports: + - "{{ stats_hddtemp_port }}:7634" + env: + HDDTEMP_ARGS: "-q -d -F /dev/sd*" + TZ: "{{ ansible_nas_timezone }}" + volumes: + - "/dev:/dev:ro" + restart_policy: unless-stopped + memory: "{{ stats_hddtemp_memory }}" + - name: Speedtest Exporter Docker Container community.docker.docker_container: name: "{{ stats_speedtest_container_name }}" diff --git a/roles/stats/tasks/grafana.yml b/roles/stats/tasks/grafana.yml index f8fcbe1c..6a02b1ad 100644 --- a/roles/stats/tasks/grafana.yml +++ b/roles/stats/tasks/grafana.yml @@ -53,6 +53,11 @@ traefik.http.routers.grafana.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.grafana.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" traefik.http.services.grafana.loadbalancer.server.port: "3000" + homepage.group: Monitoring + homepage.name: Grafana + homepage.icon: grafana + homepage.href: "http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ stats_grafana_port }}" + homepage.description: Dashboards and centralized observability. when: stats_enabled is true - name: Stop Grafana diff --git a/roles/stats/tasks/prometheus.yml b/roles/stats/tasks/prometheus.yml index f3174751..c4502662 100644 --- a/roles/stats/tasks/prometheus.yml +++ b/roles/stats/tasks/prometheus.yml @@ -46,6 +46,13 @@ traefik.http.routers.prometheus.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.prometheus.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" traefik.http.services.prometheus.loadbalancer.server.port: "9090" + homepage.group: Monitoring + homepage.name: Prometheus + homepage.icon: prometheus + homepage.href: "http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ stats_prometheus_port }}" + homepage.description: Metrics and alerting + homepage.widget.type: prometheus + homepage.widget.url: "http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ stats_prometheus_port }}" when: stats_enabled is true - name: Stop Prometheus