From b210dcd6e2f9c36a71d20f40939660aa5b538144 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Fri, 18 Feb 2022 18:36:22 +0100 Subject: [PATCH] Configure node-exporter to report correct file system metrics Without this configuration, all mount points are reporting the same utilisation metrics [1]. With the rslave option, all root mounts from the host are visible in the container, so we can remove the bind mounts for /proc and /sys. [1] https://github.com/prometheus/node_exporter#docker Change-Id: I4087dc81f9d1fa5daa24b9df6daf1f9e1ccd702f Closes-Bug: #1961438 --- ansible/roles/prometheus/defaults/main.yml | 3 +-- .../prometheus/templates/prometheus-node-exporter.json.j2 | 2 +- .../node-exporter-filesystem-metrics-d3ae7b0a892d2957.yaml | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/node-exporter-filesystem-metrics-d3ae7b0a892d2957.yaml diff --git a/ansible/roles/prometheus/defaults/main.yml b/ansible/roles/prometheus/defaults/main.yml index 1e654174c4..e7c05e0b12 100644 --- a/ansible/roles/prometheus/defaults/main.yml +++ b/ansible/roles/prometheus/defaults/main.yml @@ -191,8 +191,7 @@ prometheus_node_exporter_default_volumes: - "/etc/localtime:/etc/localtime:ro" - "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}" - "kolla_logs:/var/log/kolla/" - - "/proc:/host/proc:ro" - - "/sys:/host/sys:ro" + - "/:/host:ro,rslave" prometheus_memcached_exporter_default_volumes: - "{{ node_config_directory }}/prometheus-memcached-exporter/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/prometheus/templates/prometheus-node-exporter.json.j2 b/ansible/roles/prometheus/templates/prometheus-node-exporter.json.j2 index 6132f7afb1..b874469556 100644 --- a/ansible/roles/prometheus/templates/prometheus-node-exporter.json.j2 +++ b/ansible/roles/prometheus/templates/prometheus-node-exporter.json.j2 @@ -1,5 +1,5 @@ { - "command": "/opt/node_exporter/node_exporter --path.procfs /host/proc --path.sysfs /host/sys --web.listen-address {{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_node_exporter_port }}{% if prometheus_node_exporter_cmdline_extras %} {{ prometheus_node_exporter_cmdline_extras }}{% endif %}", + "command": "/opt/node_exporter/node_exporter --path.procfs /host/proc --path.sysfs /host/sys --path.rootfs /host --web.listen-address {{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_node_exporter_port }}{% if prometheus_node_exporter_cmdline_extras %} {{ prometheus_node_exporter_cmdline_extras }}{% endif %}", "config_files": [], "permissions": [ { diff --git a/releasenotes/notes/node-exporter-filesystem-metrics-d3ae7b0a892d2957.yaml b/releasenotes/notes/node-exporter-filesystem-metrics-d3ae7b0a892d2957.yaml new file mode 100644 index 0000000000..ad2d32a797 --- /dev/null +++ b/releasenotes/notes/node-exporter-filesystem-metrics-d3ae7b0a892d2957.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes a configuration issue with Node Exporter causing all file system + metrics of a host to be identical. + `LP#1961438 `__