From dae9cd6ec027f0203052a34806cb4d65993a8d25 Mon Sep 17 00:00:00 2001 From: Rimantas Ragainis Date: Mon, 25 Mar 2024 00:06:42 +0200 Subject: [PATCH] Add ability to disable exporter metrics itself Signed-off-by: Rimantas Ragainis --- roles/node_exporter/defaults/main.yml | 1 + roles/node_exporter/meta/argument_specs.yml | 4 ++++ roles/node_exporter/templates/node_exporter.service.j2 | 3 +++ 3 files changed, 8 insertions(+) diff --git a/roles/node_exporter/defaults/main.yml b/roles/node_exporter/defaults/main.yml index e8f39fe3..74df3b77 100644 --- a/roles/node_exporter/defaults/main.yml +++ b/roles/node_exporter/defaults/main.yml @@ -6,6 +6,7 @@ node_exporter_binary_url: "https://github.com/{{ _node_exporter_repo }}/releases node_exporter_checksums_url: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/sha256sums.txt" node_exporter_skip_install: false +node_exporter_web_disable_exporter_metrics: false node_exporter_web_listen_address: "0.0.0.0:9100" node_exporter_web_telemetry_path: "/metrics" diff --git a/roles/node_exporter/meta/argument_specs.yml b/roles/node_exporter/meta/argument_specs.yml index 4f019003..f5654dda 100644 --- a/roles/node_exporter/meta/argument_specs.yml +++ b/roles/node_exporter/meta/argument_specs.yml @@ -26,6 +26,10 @@ argument_specs: node_exporter_checksums_url: description: "URL of the node exporter checksums file" default: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/sha256sums.txt" + node_exporter_web_disable_exporter_metrics: + description: "Exclude metrics about the exporter itself (promhttp_*, process_*, go_*)." + type: bool + default: false node_exporter_web_listen_address: description: "Address on which node exporter will listen" default: "0.0.0.0:9100" diff --git a/roles/node_exporter/templates/node_exporter.service.j2 b/roles/node_exporter/templates/node_exporter.service.j2 index 467cece3..95cf5587 100644 --- a/roles/node_exporter/templates/node_exporter.service.j2 +++ b/roles/node_exporter/templates/node_exporter.service.j2 @@ -30,6 +30,9 @@ ExecStart={{ node_exporter_binary_install_dir }}/node_exporter \ '--web.config=/etc/node_exporter/config.yaml' \ {% endif %} {% endif %} +{% if node_exporter_web_disable_exporter_metrics %} + '--web.disable-exporter-metrics' \ +{% endif %} {% if node_exporter_version is version('1.5.0', '>=') and node_exporter_web_listen_address is iterable and node_exporter_web_listen_address is not mapping and