create grafana and prometheus setup

This commit is contained in:
tenksom 2024-04-29 14:21:58 +02:00
parent d03f4c6fb1
commit 9327314ec9

23
modules/monitoring.nix Normal file
View file

@ -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;
};
};
}