aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2026-09-27 13:13:05 +0200
committerDennis Fink2026-09-27 13:13:05 +0200
commit142af72ebc9e1c2151101d6c3318ee48fdf00a87 (patch)
tree6d9d9c8b7876780e002170effec83cf18ba4dfdc
parentdab9faa18b9d4cb06a88acf8842ce525434dd890 (diff)
downloadprometheus-pacman-exporter-142af72ebc9e1c2151101d6c3318ee48fdf00a87.tar.gz
prometheus-pacman-exporter-142af72ebc9e1c2151101d6c3318ee48fdf00a87.zip
feat(systemd): retry failed exporter runs
Update the systemd service to restart the exporter on failure up to five times with a ten-minute delay between attempts. Update the systemd timer to use Persistent=true so missed daily runs are triggered after downtime, and remove network-online ordering from the timer. Keep network-online ordering on the service and remove the stale borg cache reference from its hardening comment.
-rw-r--r--contrib/prometheus-pacman-exporter.service9
-rw-r--r--contrib/prometheus-pacman-exporter.timer3
2 files changed, 9 insertions, 3 deletions
diff --git a/contrib/prometheus-pacman-exporter.service b/contrib/prometheus-pacman-exporter.service
index 3b3dfa6..b463cbf 100644
--- a/contrib/prometheus-pacman-exporter.service
+++ b/contrib/prometheus-pacman-exporter.service
@@ -3,15 +3,22 @@ Description=Pacman Prometheus metrics exporter
After=network-online.target
Wants=network-online.target
+# Allow the initial attempt plus five retries.
+StartLimitIntervalSec=2h
+StartLimitBurst=6
+
[Service]
Type=oneshot
EnvironmentFile=/etc/conf.d/prometheus-pacman-exporter
ExecStart=/usr/bin/prometheus-pacman-exporter $PROMETHEUS_PACMAN_EXPORTER_ARGS
+Restart=on-failure
+RestartSec=10min
+
User=root
Group=root
-# Needs write access to emit the .prom file and read/write the borg cache.
+# Needs write access to emit the .prom file.
# All other paths read-only by default
ReadWritePaths=/var/lib/prometheus/node-exporter
# Mount a private /tmp not shared with the rest of the system
diff --git a/contrib/prometheus-pacman-exporter.timer b/contrib/prometheus-pacman-exporter.timer
index 46afeea..5fa7b81 100644
--- a/contrib/prometheus-pacman-exporter.timer
+++ b/contrib/prometheus-pacman-exporter.timer
@@ -1,11 +1,10 @@
[Unit]
Description=Run Pacman Prometheus metrics exporter daily
-After=network-online.target
-Wants=network-online.target
[Timer]
OnCalendar=daily
AccuracySec=1h
+Persistent=true
[Install]
WantedBy=timers.target