diff --git a/modules/monitoring.nix b/modules/monitoring.nix index e7723db..2b46a41 100644 --- a/modules/monitoring.nix +++ b/modules/monitoring.nix @@ -42,4 +42,41 @@ with pkgs; }; }; + # Metrics collection + services.prometheus = { + enable = true; + port = 9001; + exporters = { + node = { + enable = true; + enabledCollectors = [ "systemd" ]; + port = 9002; + }; + zfs.enable = true; + wireguard.enable = true; + postgres.enable = true; + smartctl.enable = true; + #nginx.enable = true; + dnsmasq.enable = true; + }; + scrapeConfigs = [{ + job_name = "zion"; + static_configs = [{ + targets = [ + "localhost:${toString config.services.prometheus.exporters.node.port}" + ]; + }]; + }]; + }; + + # Grafana configuration + services.grafana = { + enable = true; + settings.server = { + domain = "grafana.coolneng.duckdns.org"; + http_port = 9009; + http_addr = "127.0.0.1"; + }; + }; + } diff --git a/modules/webstack.nix b/modules/webstack.nix index c26b8f2..0860ca6 100644 --- a/modules/webstack.nix +++ b/modules/webstack.nix @@ -49,6 +49,12 @@ add_header Access-Control-Allow-Origin * always; ''; }; + "/nginx_status/".extraConfig = '' + stub_status on; + access_log off; + allow 127.0.0.1; + deny all; + ''; }; }; "radicale.coolneng.duckdns.org" = { @@ -150,6 +156,14 @@ ''; }; }; + "grafana.coolneng.duckdns.org" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://localhost:9009/"; + proxyWebsockets = true; + }; + }; }; };