From a15e75915dc742ec91c4c69c7d633e85cc15928f Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Mon, 16 Sep 2024 23:53:48 +0700 Subject: [PATCH] jellyfin: enabled prometheus metrics endpoint --- system/services/jellyfin.nix | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/system/services/jellyfin.nix b/system/services/jellyfin.nix index 763f478..10db5ad 100644 --- a/system/services/jellyfin.nix +++ b/system/services/jellyfin.nix @@ -16,7 +16,26 @@ in chmod -R 0777 /nas/mediaserver ''; services.caddy.virtualHosts.${domain}.extraConfig = '' - reverse_proxy 0.0.0.0:8096 + @public not remote_ip private_ranges + + handle_path /metrics { + respond @public < + + + Access Denied + + +

Access Denied

+ + + HTML 403 + reverse_proxy 0.0.0.0:8096 + } + + handle { + reverse_proxy 0.0.0.0:8096 + } ''; services.caddy.virtualHosts.${domain-jellyseerr} = mkIf cfg.jellyseerr.enable { extraConfig = '' @@ -31,5 +50,13 @@ in services.jellyseerr = mkIf cfg.jellyseerr.enable { enable = true; }; + + environment.etc."alloy/config.alloy".text = /*hcl*/ '' + prometheus.scrape "jellyfin" { + targets = [{__address__ = "0.0.0.0:8096"}] + job_name = "jellyfin" + forward_to = [prometheus.remote_write.mimir.receiver] + } + ''; }; }