Skip to content

Commit

Permalink
Gracefully handle absence of environment configuration file (#3062)
Browse files Browse the repository at this point in the history
node_exporter has reasonable defaults so it is able to start without explicit config.
Such a setup is common in /usr/-only images where /etc/ is an empty tmpfs upon boot.

Signed-off-by: Nils K <24257556+septatrix@users.noreply.github.com>
  • Loading branch information
septatrix authored Sep 22, 2024
1 parent 076cc40 commit 715a2ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/systemd/node_exporter.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Requires=node_exporter.socket

[Service]
User=node_exporter
EnvironmentFile=/etc/sysconfig/node_exporter
# Fallback when environment file does not exist
Environment=OPTIONS=
EnvironmentFile=-/etc/sysconfig/node_exporter
ExecStart=/usr/sbin/node_exporter --web.systemd-socket $OPTIONS

[Install]
Expand Down

0 comments on commit 715a2ed

Please sign in to comment.