diff --git a/nixos/modules/monitoring/exporters/tahoe.nix b/nixos/modules/monitoring/exporters/tahoe.nix index 17b6320e3a01e18fd9a08c848e4223c65902e158..9bffabe74d45341b981ce3eb1cf05323e71fb5c4 100644 --- a/nixos/modules/monitoring/exporters/tahoe.nix +++ b/nixos/modules/monitoring/exporters/tahoe.nix @@ -39,12 +39,14 @@ in { config = lib.mkIf cfg.enable { environment.systemPackages = [ pkgs.curl ]; + systemd.services.tahoe-metrics-collector = { enable = true; description = "Tahoe metrics gathering service"; - wantedBy = [ "multi-user.target" ]; + after = [ "tahoe.storage.service" ]; startAt = cfg.interval; path = [ pkgs.curl ]; + restartIfChanged = false; # Save to a temp file and then move atomically so the # textfile collector won't read a partial file. @@ -54,6 +56,10 @@ in { mv "${cfg.outFile}.tmp" "${cfg.outFile}" ''; }; + + systemd.timers.tahoe-metrics-collector = { + after = [ "tahoe.storage.service" ]; + }; }; }