feat: massive refactoring...

This commit is contained in:
Xavier Morel
2025-11-09 00:45:00 +01:00
parent f9446df46d
commit 3245b6b89f
77 changed files with 3233 additions and 582 deletions

View File

@@ -0,0 +1,43 @@
{
config,
tools,
pkgs,
...
}:
let
lib = pkgs.lib;
in
{
services.prometheus = {
enable = true;
extraFlags = [
"--web.enable-otlp-receiver"
"--web.enable-remote-write-receiver"
];
globalConfig = {
scrape_interval = "30s";
};
scrapeConfigs = [
{
job_name = "prometheus";
static_configs = [
{ targets = [ "localhost:9090" ]; }
];
}
]
++ (lib.filter (sc: sc.static_configs != [ ]) (
lib.mapAttrsToList (
container: def:
let
container_ip = tools.build_ip container;
in
{
job_name = container;
static_configs = map (port: {
targets = [ "${container_ip}:${toString port}" ];
}) def.logging.prometheusPorts;
}
) config.my-lxc
));
};
}