1
0
forked from c3d2/nix-config

stats: move nginx status port to the same port as the node_exporter proxy

This commit is contained in:
Sandro - 2023-04-24 20:13:05 +02:00
parent 13e0febab4
commit ad86d6d59b
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5

View File

@ -15,7 +15,9 @@ in
config = { config = {
services = lib.mkMerge [ services = lib.mkMerge [
{ (let
nginxStatusPort = 9100;
in {
collectd = lib.mkIf cfg.enable { collectd = lib.mkIf cfg.enable {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
@ -50,7 +52,7 @@ in
thermal = ""; thermal = "";
} // lib.optionalAttrs config.services.nginx.enable { } // lib.optionalAttrs config.services.nginx.enable {
nginx = '' 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 { nginx = lib.mkIf config.services.nginx.enable {
virtualHosts.localhost = { virtualHosts.localhost = {
listen = [ listen = [
{ { addr = "127.0.0.1"; port = nginxStatusPort; }
addr = "127.0.0.1"; { addr = "[::1]"; port = nginxStatusPort; }
port = 9102;
}
{
addr = "[::1]";
port = 9102;
}
]; ];
locations."/nginx_status".extraConfig = '' locations."/nginx_status".extraConfig = ''
stub_status; stub_status;
@ -77,7 +73,7 @@ in
''; '';
}; };
}; };
} })
(lib.mkIf (pkgs.system != "riscv64-linux") { (lib.mkIf (pkgs.system != "riscv64-linux") {
nginx = { nginx = {