From 715a2ed67470194681b1d6e4a4bebf2daf2350c3 Mon Sep 17 00:00:00 2001 From: Nils K <24257556+septatrix@users.noreply.github.com> Date: Sun, 22 Sep 2024 19:34:41 +0200 Subject: [PATCH] Gracefully handle absence of environment configuration file (#3062) 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> --- examples/systemd/node_exporter.service | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/systemd/node_exporter.service b/examples/systemd/node_exporter.service index 82553e91..1ef24442 100644 --- a/examples/systemd/node_exporter.service +++ b/examples/systemd/node_exporter.service @@ -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]