fixes
authorIan Kelling <iank@fsf.org>
Sat, 8 Apr 2023 03:43:37 +0000 (23:43 -0400)
committerIan Kelling <iank@fsf.org>
Sat, 8 Apr 2023 03:43:37 +0000 (23:43 -0400)
prom-node-exporter

index d46a4bfe9069b6d97d0751dad5881c44e97a6f0e..61fe700a6e6b5b29d623f14a6be816a916db9d53 100755 (executable)
@@ -127,7 +127,9 @@ i /etc/default/prometheus-node-exporter <<EOF
 # 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
 
@@ -158,7 +160,7 @@ if [[ -d /etc/systemd/system ]]; then # we are using systemd
     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
@@ -170,10 +172,10 @@ RestartSec=600
 
 # 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