Skip to content

Inconsistent indentation in node_exporter systemd unit ExecStart line #886

Description

@cod3mas0n

When rendering the node_exporter systemd service unit from the Jinja2 template, collector arguments receive inconsistent leading whitespace.

Example of rendered output:

ExecStart=/usr/local/bin/node_exporter \
    '--collector.systemd' \
'--collector.textfile' \
    '--collector.textfile.directory=/var/lib/node_exporter' \
'--collector.filesystem' \
    '--collector.filesystem.ignored-fs-types=^(sys|proc|auto)fs$' \
    '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev)($|/)' \
    '--web.listen-address=0.0.0.0:9100' \
    '--web.telemetry-path=/metrics'

The line for mapping-style collectors (textfile, filesystem) lose their indentation, while simple string collectors are correctly indented.

Root cause:

Whitespace control (-%}) combined with the different code paths for string vs. mapping collectors in the Jinja2 template produces uneven leading spaces.

Variables that trigger the issue:

node_exporter_enabled_collectors:
  - systemd
  - textfile:
      directory: "{{ node_exporter_textfile_dir }}"
  - filesystem:
      ignored-mount-points: "^/(sys|proc|dev)($|/)"
      ignored-fs-types: "^(sys|proc|auto)fs$"

node_exporter_disabled_collectors: []

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions