# Due to shell scaping, to pass backslashes for regexes, you need to double
# them (\\d for \d). If running under systemd, you need to double them again
# (\\\\d to mean \d), and escape newlines too.
-ARGS="--web.listen-address=${listen_address}:9100 --collector.textfile.directory=/var/lib/prometheus/node-exporter"
+
+# sometime before 1.5 systemd was a default collector
+ARGS="--web.listen-address=${listen_address}:9100 --collector.textfile.directory=/var/lib/prometheus/node-exporter --collector.systemd"
# to see all possible args, run with --help
EOF
fi
- i /etc/systemd/system/prometheus.service.d/override.conf <<'EOF'
+ i /etc/systemd/system/prometheus-node-exporter.service.d/override.conf <<'EOF'
[Unit]
# needed to continually restart
StartLimitIntervalSec=0
# empty signifies to replace the existing value
ExecStart=
-ExecStart=/usr/local/bin/prometheus $ARGS
+ExecStart=/usr/local/bin/prometheus-node-exporter $ARGS
EOF
else # we dont have the distro package installed
- i /etc/systemd/system/prometheus.service <<'EOF'
+ i /etc/systemd/system/prometheus-node-exporter.service <<'EOF'
[Unit]
Description=Prometheus exporter for machine metrics
Documentation=https://github.com/prometheus/node_exporter