fi
- #why have
- # this logic to handle both cases: The only differences of the
+ # I used to have logic to handle having the distro package installed, which would then just override it's service file in some ways. The only differences of the
# packaged version in t11 is that it creates /var/log/prometheus and a
# logrotate, but nothing is logged there. And it depends on
- # prometheus-node-exporter-collectors, which is useful, but that
- # package itself depends on prometheus-node-exporter. We have no
+ # prometheus-node-exporter-collectors, which is useful, but
+ # depends on prometheus-node-exporter. We would have no
# reason to install prometheus-node-exporter except that
- # dependency. We could fix that, but this is easier. So, we keep
- # handling both cases in case we fix that or maybe run a different
- # distro that doesn't have it.
- if [[ -e /lib/systemd/system/prometheus-node-exporter.service ]]; then
-
- if [[ -e /etc/systemd/system/prometheus.service ]]; then
- rm -f /etc/systemd/system/prometheus.service
- sysd_reload=true
- fi
-
-
- i /etc/systemd/system/prometheus-node-exporter.service.d/override.conf <<'EOF'
-[Unit]
-# needed to continually restart
-StartLimitIntervalSec=0
+ # dependency. But since the collectors package is just a few
+ # small scripts we don't even currently use, and of course are not
+ # there on old versions, lets not try to use that package, and
+ # just manually install the files we want from upstream.
+ # https://github.com/prometheus-community/node-exporter-textfile-collector-scripts
-[Service]
-Restart=always
-# time to sleep before restarting a service
-RestartSec=600
+ if [[ -e /lib/systemd/system/prometheus-node-exporter.service ]]; then
+ apt -y remove --purge prometheus-node-exporter
+ rm -fv /lib/systemd/system/prometheus-node-exporter.service
+ fi
-# empty signifies to replace the existing value
-ExecStart=
-ExecStart=/usr/local/bin/prometheus-node-exporter $ARGS
-EOF
- else # we dont have the distro package installed
- i /etc/systemd/system/prometheus-node-exporter.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
[Install]
WantedBy=multi-user.target
EOF
- fi
if $sysd_reload; then
systemctl daemon-reload
fi