nixos-config/hosts/x86_64-linux/beleth/monitoring.nix

49 lines
1,009 B
Nix
Raw Normal View History

2024-04-01 02:29:05 +02:00
{
config,
pkgs,
...
}: {
networking.firewall.allowedTCPPorts = [80 443 9001];
services.grafana = {
enable = true;
settings.server = {
port = 2342;
addr = "127.0.0.1";
};
};
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = ["systemd" "sysctl" "powersupplyclass"];
port = 9002;
};
};
scrapeConfigs = [
{
job_name = "beleth";
static_configs = [
{
targets = ["127.0.0.1:${toString config.services.prometheus.exporters.node.port}"];
}
];
}
];
};
services.nginx.virtualHosts."grafana.heroin.trade" = {
forceSSL = true;
enableACME = true;
locations."/" = {
extraConfig = ''
proxy_set_header Host $host;
'';
proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}";
proxyWebsockets = true;
};
};
}