# 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"
+ARGS="--web.listen-address=${listen_address}:9100 --collector.textfile.directory=/var/lib/prometheus/node-exporter"
# to see all possible args, run with --help
EOF
if [[ -d /etc/systemd/system ]]; then # we are using systemd
+
+ # this is just fixing a screwed up state we shouldnt get into normally.
+ if [[ -e /etc/init.d/prometheus-node-exporter ]]; then
+ sysd_reload=true
+ rm -f /etc/init.d/prometheus-node-exporter
+ fi
+
+
+ #why have
+ # this logic to handle both cases: 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
+ # 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.service.d/override.conf <<'EOF'
[Unit]
# needed to continually restart