infrastructure/modules/nixos/dgn-monitoring/default.nix

67 lines
1.5 KiB
Nix

{
config,
lib,
meta,
name,
nodeMeta,
...
}:
let
inherit (lib) filterAttrs mapAttrsToList optional;
in
{
services.vmagent = {
enable = true;
flags = {
"remoteWrite.url" = "http://${meta.network.storage01.netbirdIp}:8428/api/v1/write";
"remoteWrite.label" = "node=${name}";
};
prometheusConfig = {
scrape_configs =
mapAttrsToList
(job_name: cfg: {
inherit job_name;
static_configs = [ { targets = [ "127.0.0.1:${builtins.toString cfg.port}" ]; } ];
})
(
filterAttrs (
name: cfg:
!(builtins.elem name [
"assertions"
"warnings"
"blackbox"
"unifi-poller"
"domain"
"minio"
"idrac"
"pve"
"tor"
])
&& cfg.enable
) config.services.prometheus.exporters
);
global = {
scrape_interval = "15s";
external_labels.hostname = "${name}.${nodeMeta.site}.infra.dgnum.eu";
};
};
};
# services.prometheus.exporters = {
# node = {
# enable = true;
# enabledCollectors = [ "systemd" ] ++ (optional config.boot.zfs.enabled "zfs");
# };
# };
services.journald.upload = {
enable = true;
settings = {
Upload.URL = "http://${meta.network.storage01.netbirdIp}:9428/insert/journald";
};
};
}