diff --git a/flake.lock b/flake.lock index c0f90bd..999ff1f 100644 --- a/flake.lock +++ b/flake.lock @@ -459,11 +459,11 @@ ] }, "locked": { - "lastModified": 1794762093, - "narHash": "sha256-V/kGdmXLMAmUn3P/a7qRhda9a3HaAytepJw9qhKTnYc=", + "lastModified": 1794770655, + "narHash": "sha256-QeoSL4DO9v9UiEya/fcrHYtyN3lWAOL1xY9JfvazJZI=", "owner": "nixos-homelab", "repo": "monitoring", - "rev": "b4cb9bc61f741a6dcfbe7f14a9baa57db817bf01", + "rev": "b0b4bcba5cc3054b72e3404c10ccac2a9395665d", "type": "github" }, "original": { diff --git a/nix/modules/plex/metrics.nix b/nix/modules/plex/metrics.nix index 26f97bf..458f88a 100644 --- a/nix/modules/plex/metrics.nix +++ b/nix/modules/plex/metrics.nix @@ -9,7 +9,9 @@ let cfg = config.homelab.plex; # Its published image (alpine and the binary; no releases, so main by digest), pinned in the Dockerfile here - image = (inputs.homelab-shared.lib.images.pinned pkgs ./Dockerfile)."ghcr.io/jsclayton/prometheus-plex-exporter"; + image = + (inputs.homelab-shared.lib.images.pinned pkgs ./Dockerfile) + ."ghcr.io/jsclayton/prometheus-plex-exporter"; # The exporter takes the admin token in PLEX_TOKEN. Plex keeps it in Preferences.xml once claimed, on the data # volume the sidecar mounts read-only: wait until it's there, then exec the exporter. Waiting keeps the pod Ready, # so an unclaimed Plex stays reachable to be claimed; when the exporter exits, the kubelet restarts it @@ -28,7 +30,13 @@ let in { imports = [ inputs.homelab-monitoring.nixosModules.alloy ]; - config = lib.mkIf cfg.enable ( + options.homelab.plex.metrics.enable = lib.mkOption { + description = "Whether Alloy scrapes Plex's metrics, and runs its prometheus-plex-exporter sidecar."; + type = lib.types.bool; + default = config.homelab.alloy.enable; + defaultText = lib.literalExpression "config.homelab.alloy.enable"; + }; + config = lib.mkIf (cfg.enable && cfg.metrics.enable) ( lib.mkMerge [ { homelab.alloy.monitors.plex.podPort = port; } (lib.mkIf config.homelab.alloy.enable { diff --git a/nix/modules/prowlarr/metrics.nix b/nix/modules/prowlarr/metrics.nix index 6d4151d..524794d 100644 --- a/nix/modules/prowlarr/metrics.nix +++ b/nix/modules/prowlarr/metrics.nix @@ -11,7 +11,13 @@ let in { imports = [ inputs.homelab-monitoring.nixosModules.alloy ]; - config = lib.mkIf config.homelab.prowlarr.enable ( + options.homelab.prowlarr.metrics.enable = lib.mkOption { + description = "Whether Alloy scrapes Prowlarr's metrics, and runs its exportarr sidecar."; + type = lib.types.bool; + default = config.homelab.alloy.enable; + defaultText = lib.literalExpression "config.homelab.alloy.enable"; + }; + config = lib.mkIf (config.homelab.prowlarr.enable && config.homelab.prowlarr.metrics.enable) ( lib.mkMerge [ { homelab.alloy.monitors.prowlarr.podPort = exportarr.port; } (lib.mkIf config.homelab.alloy.enable { diff --git a/nix/modules/radarr/metrics.nix b/nix/modules/radarr/metrics.nix index 7d9f9d3..a8e6de0 100644 --- a/nix/modules/radarr/metrics.nix +++ b/nix/modules/radarr/metrics.nix @@ -11,7 +11,13 @@ let in { imports = [ inputs.homelab-monitoring.nixosModules.alloy ]; - config = lib.mkIf config.homelab.radarr.enable ( + options.homelab.radarr.metrics.enable = lib.mkOption { + description = "Whether Alloy scrapes Radarr's metrics, and runs its exportarr sidecar."; + type = lib.types.bool; + default = config.homelab.alloy.enable; + defaultText = lib.literalExpression "config.homelab.alloy.enable"; + }; + config = lib.mkIf (config.homelab.radarr.enable && config.homelab.radarr.metrics.enable) ( lib.mkMerge [ { homelab.alloy.monitors.radarr = { diff --git a/nix/modules/rtorrent/metrics.nix b/nix/modules/rtorrent/metrics.nix index 526fd32..7b8623f 100644 --- a/nix/modules/rtorrent/metrics.nix +++ b/nix/modules/rtorrent/metrics.nix @@ -70,7 +70,13 @@ let in { imports = [ inputs.homelab-monitoring.nixosModules.alloy ]; - config = lib.mkIf cfg.enable ( + options.homelab.rtorrent.metrics.enable = lib.mkOption { + description = "Whether Alloy scrapes rtorrent's metrics, and runs its rtorrent_exporter and SCGI bridge sidecars."; + type = lib.types.bool; + default = config.homelab.alloy.enable; + defaultText = lib.literalExpression "config.homelab.alloy.enable"; + }; + config = lib.mkIf (cfg.enable && cfg.metrics.enable) ( lib.mkMerge [ { homelab.alloy.monitors.rtorrent.podPort = metricsPort; } (lib.mkIf config.homelab.alloy.enable { diff --git a/nix/modules/sabnzbd/metrics.nix b/nix/modules/sabnzbd/metrics.nix index 5f8d17d..6fbc7fc 100644 --- a/nix/modules/sabnzbd/metrics.nix +++ b/nix/modules/sabnzbd/metrics.nix @@ -11,7 +11,13 @@ let in { imports = [ inputs.homelab-monitoring.nixosModules.alloy ]; - config = lib.mkIf config.homelab.sabnzbd.enable ( + options.homelab.sabnzbd.metrics.enable = lib.mkOption { + description = "Whether Alloy scrapes SABnzbd's metrics, and runs its exportarr sidecar."; + type = lib.types.bool; + default = config.homelab.alloy.enable; + defaultText = lib.literalExpression "config.homelab.alloy.enable"; + }; + config = lib.mkIf (config.homelab.sabnzbd.enable && config.homelab.sabnzbd.metrics.enable) ( lib.mkMerge [ { homelab.alloy.monitors.sabnzbd.podPort = exportarr.port; } (lib.mkIf config.homelab.alloy.enable { diff --git a/nix/modules/sonarr/metrics.nix b/nix/modules/sonarr/metrics.nix index 7341bb8..69fe216 100644 --- a/nix/modules/sonarr/metrics.nix +++ b/nix/modules/sonarr/metrics.nix @@ -11,7 +11,13 @@ let in { imports = [ inputs.homelab-monitoring.nixosModules.alloy ]; - config = lib.mkIf config.homelab.sonarr.enable ( + options.homelab.sonarr.metrics.enable = lib.mkOption { + description = "Whether Alloy scrapes Sonarr's metrics, and runs its exportarr sidecar."; + type = lib.types.bool; + default = config.homelab.alloy.enable; + defaultText = lib.literalExpression "config.homelab.alloy.enable"; + }; + config = lib.mkIf (config.homelab.sonarr.enable && config.homelab.sonarr.metrics.enable) ( lib.mkMerge [ { homelab.alloy.monitors.sonarr = {