fix(monitoring): order smartctl exporter after network-online.target (#372)

The exporter binds to the host LAN address, which systemd-networkd
assigns during boot. Without ordering, the service starts before the
address exists, `bind: cannot assign requested address` trips the
start limit, and the unit stays failed until restarted manually.

Order the unit after network-online.target, and since wait-online is
best-effort (120s timeout), also retry patiently so the unit self-heals
when the link comes up late.
This commit is contained in:
ryan4yin | 二花 authored and GitHub committed 2026-10-03 18:54:08 +08:00
1 parent 3a5b9ec4c6
commit 1b31730db4
1 file changed
+13
+13
View File
@@ -54,4 +54,17 @@
port = 9633;
maxInterval = "60s";
};
# The exporter binds to the LAN address, which networkd assigns during boot;
# without ordering it races the address and trips the start limit (seen on ai).
# wait-online is best-effort (120s timeout), so also retry patiently to
# self-heal when the link comes up late.
systemd.services.prometheus-smartctl-exporter = lib.mkIf config.modules.hardwareTools.enable {
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig = {
RestartSec = "10s";
StartLimitIntervalSec = 0;
};
};
}