diff --git a/modules/stats.nix b/modules/stats.nix index b25f30cc..636eca8b 100644 --- a/modules/stats.nix +++ b/modules/stats.nix @@ -15,7 +15,9 @@ in config = { services = lib.mkMerge [ - { + (let + nginxStatusPort = 9100; + in { collectd = lib.mkIf cfg.enable { enable = true; extraConfig = '' @@ -50,7 +52,7 @@ in thermal = ""; } // lib.optionalAttrs config.services.nginx.enable { nginx = '' - URL "http://localhost/nginx_status" + URL "http://localhost:${toString nginxStatusPort}/nginx_status" ''; }; }; @@ -58,14 +60,8 @@ in nginx = lib.mkIf config.services.nginx.enable { virtualHosts.localhost = { listen = [ - { - addr = "127.0.0.1"; - port = 9102; - } - { - addr = "[::1]"; - port = 9102; - } + { addr = "127.0.0.1"; port = nginxStatusPort; } + { addr = "[::1]"; port = nginxStatusPort; } ]; locations."/nginx_status".extraConfig = '' stub_status; @@ -77,7 +73,7 @@ in ''; }; }; - } + }) (lib.mkIf (pkgs.system != "riscv64-linux") { nginx = {