From 1b31730db479bc398e28ee89d071a87f9b130948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ryan4yin=20=7C=20=E4=BA=8C=E8=8A=B1?= Date: Sat, 3 Oct 2026 18:54:08 +0800 Subject: [PATCH] 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. --- modules/nixos/base/monitoring.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/nixos/base/monitoring.nix b/modules/nixos/base/monitoring.nix index 06e7cdd0..692c36cd 100644 --- a/modules/nixos/base/monitoring.nix +++ b/modules/nixos/base/monitoring.nix @@ -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; + }; + }; }