nixos/nixos/hosts/monitoring/default.nix
2024-02-11 04:01:42 -05:00

70 lines
1.5 KiB
Nix

{ ... }: {
imports = [
../../templates/proxmox-lxc.nix
../../server.nix
../../features/dns-cache.nix
];
networking.hostName = "monitoring";
system.stateVersion = "24.05";
nixpkgs.hostPlatform = "x86_64-linux";
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "0.0.0.0";
http_port = 3000;
domain = "monitoring.hoki-porgy.ts.net";
};
};
provision = {
enable = true;
datasources.settings.datasources = [
{
url = "http://localhost:4000";
type = "prometheus";
name = "Prometheus";
}
];
};
};
services.prometheus = {
enable = true;
port = 4000;
scrapeConfigs = let
static = name: ports: {
job_name = name;
static_configs = [
{
targets = map (port: "${name}.hoki-porgy.ts.net:${builtins.toString port}") ports;
}
];
};
ports = {
node = 14200;
nginx = 14201;
pve = 14210;
};
in with ports; [
(static "aerial" [ node ])
(static "pineapple" [ node nginx ])
(static "watermelon" [ node nginx ])
(static "mango" [ node ])
(static "happystaticbuzz" [ node ])
(static "keylime" [ node ])
(static "keysmash" [ node ])
(static "ingress-proxy" [ node nginx ])
{
job_name = "pve1";
static_configs = [
{ targets = map (port: "192.168.1.128:${builtins.toString port}") [ node pve ]; }
];
}
];
};
}