From 9327314ec9b61b6b3a8a2a23f7e5c73ce9148435 Mon Sep 17 00:00:00 2001 From: tenksom Date: Mon, 29 Apr 2024 14:21:58 +0200 Subject: [PATCH] create grafana and prometheus setup --- modules/monitoring.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 modules/monitoring.nix diff --git a/modules/monitoring.nix b/modules/monitoring.nix new file mode 100644 index 0000000..d3cdb3e --- /dev/null +++ b/modules/monitoring.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + let + domain = "monitoring.${config.networking.domain}"; + in { + # grafana configuration + services.grafana = { + enable = true; + port = 2342; + }; + + services.prometheus = { + enable = true; + port = 9001; + }; + + # nginx reverse proxy + services.nginx.virtualHosts.${domain} = { + locations."/" = { + proxyPass = "http://localhost:${toString config.services.grafana.port}"; + proxyWebsockets = true; + }; + }; +}