about summary refs log tree commit diff
path: root/modules/piracy/sonarr.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/piracy/sonarr.nix')
-rw-r--r--modules/piracy/sonarr.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/piracy/sonarr.nix b/modules/piracy/sonarr.nix
index 0761a3d..5440bf4 100644
--- a/modules/piracy/sonarr.nix
+++ b/modules/piracy/sonarr.nix
@@ -61,7 +61,22 @@ in
       };
     };
 
+    environment.etc."alloy/sonarr.alloy".text =
+      with config.services.prometheus.exporters.exportarr-sonarr; ''
+        prometheus.scrape "sonarr" {
+          targets = [
+            {
+              __address__ = "${listenAddress}:${toString port}",
+              instance    = "${config.networking.hostName}",
+            }
+          ]
+          forward_to = [prometheus.relabel.default.receiver]
+        }
+      '';
+
     systemd = {
+      services.alloy.reloadTriggers = [ config.environment.etc."alloy/sonarr.alloy".source ];
+
       tmpfiles.rules = with config.services.sonarr; [
         "d /var/lib/sonarr/root 0755 ${user} ${group} - -"
       ];

Consider giving Nix/NixOS a try! <3