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

48 lines
1,009 B
Nix
Raw Permalink Normal View History

2024-03-30 22:12:21 +01:00
{
config,
pkgs,
...
}: {
networking.firewall.allowedTCPPorts = [80 443 9001];
2024-03-30 20:52:03 +01:00
services.grafana = {
enable = true;
2024-03-30 22:12:21 +01:00
settings.server = {
2024-03-31 01:29:35 +01:00
domain = "grafana.fritz.box";
2024-03-30 22:12:21 +01:00
port = 2342;
addr = "127.0.0.1";
};
};
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
2024-04-01 02:29:05 +02:00
enabledCollectors = ["systemd" "sysctl" "powersupplyclass"];
2024-03-30 22:12:21 +01:00
port = 9002;
};
};
scrapeConfigs = [
{
job_name = "seraphim";
static_configs = [
{
targets = ["127.0.0.1:${toString config.services.prometheus.exporters.node.port}"];
}
];
}
];
2024-03-30 20:52:03 +01:00
};
2024-03-30 22:12:21 +01:00
services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = {
2024-03-30 20:52:03 +01:00
locations."/" = {
2024-03-30 22:12:21 +01:00
extraConfig = ''
proxy_set_header Host $host;
'';
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
proxyWebsockets = true;
2024-03-30 20:52:03 +01:00
};
};
}