From 8c6e55d2bdde9d243a3105ab09b337c9c2b82006 Mon Sep 17 00:00:00 2001 From: June Date: Tue, 3 Nov 2026 02:12:18 +0100 Subject: [PATCH] alloy(role): enable node exporter textfile collector Enable the node exporter textfile collector, which allows for collecting custom statistics in a simple way. https://github.com/prometheus/node_exporter#textfile-collector --- inventories/chaosknoten/group_vars/all.yaml | 5 ++++- inventories/z9/group_vars/all.yaml | 5 ++++- roles/alloy/tasks/main.yaml | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/inventories/chaosknoten/group_vars/all.yaml b/inventories/chaosknoten/group_vars/all.yaml index 76147d88..dc5bc27b 100644 --- a/inventories/chaosknoten/group_vars/all.yaml +++ b/inventories/chaosknoten/group_vars/all.yaml @@ -50,7 +50,10 @@ alloy_config_default: | } prometheus.exporter.unix "local_system" { - enable_collectors = ["systemd"] + enable_collectors = ["systemd", "textfile"] + textfile { + directory = "/var/lib/node_exporter_textfile/" + } } prometheus.scrape "scrape_metrics" { diff --git a/inventories/z9/group_vars/all.yaml b/inventories/z9/group_vars/all.yaml index 5cc32330..b59e724e 100644 --- a/inventories/z9/group_vars/all.yaml +++ b/inventories/z9/group_vars/all.yaml @@ -50,7 +50,10 @@ alloy_config_default: | } prometheus.exporter.unix "local_system" { - enable_collectors = ["systemd"] + enable_collectors = ["systemd", "textfile"] + textfile { + directory = "/var/lib/node_exporter_textfile/" + } } prometheus.scrape "scrape_metrics" { diff --git a/roles/alloy/tasks/main.yaml b/roles/alloy/tasks/main.yaml index b7cf8d6e..2559dc9c 100644 --- a/roles/alloy/tasks/main.yaml +++ b/roles/alloy/tasks/main.yaml @@ -1,6 +1,14 @@ --- - name: Deploy Grafana Alloy with config block: + - name: Create directory for node_exporter textfile collector + ansible.builtin.file: + path: /var/lib/node_exporter_textfile + state: directory + mode: "0755" + owner: root + group: root + - name: Install Alloy ansible.builtin.include_tasks: install.yaml