os/modules/monitoring-server/default.nix
2023-10-06 00:01:55 +02:00

70 lines
1.3 KiB
Nix

{
lib,
config,
pkgs,
...
}:
with lib; let
psCfg = config.pub-solar;
cfg = config.pub-solar.monitoring-server;
in {
options.pub-solar.monitoring-server = {
enable = mkEnableOption "Install a monitoring server node";
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [2342 9001];
pub-solar.monitoring-client = {
enable = true;
listenAddress = "10.0.1.6";
};
services.grafana = {
enable = true;
port = 2342;
addr = "10.0.1.6";
};
services.prometheus = {
enable = true;
listenAddress = "10.0.1.6";
port = 9001;
scrapeConfigs = [
{
job_name = "chonk";
static_configs = [
{
targets = ["10.0.1.6:9002"];
}
];
}
{
job_name = "giggles";
static_configs = [
{
targets = ["10.0.1.11:9002"];
}
];
}
{
job_name = "cox";
static_configs = [
{
targets = ["10.0.1.12:9002"];
}
];
}
{
job_name = "companion";
static_configs = [
{
targets = ["10.0.1.13:9002"];
}
];
}
];
};
};
}