infrastructure/services/prometheus.nix
kat witch 8db7cbfdb3
services/{grafana,loki,node-exporter,promtail}.nix: init
Added monitoring stack and applied monitoring stack to each node worth
monitoring.
2021-05-03 13:56:31 +01:00

22 lines
521 B
Nix

{ config, hosts, lib, ... }:
with lib;
let
prom_configs =
(mapAttrs (hostName: host: host.config.services.prometheus.exporters.node)
(filterAttrs
(_: host: host.config.services.prometheus.exporters.node.enable)
hosts));
in {
services.prometheus = {
enable = true;
scrapeConfigs = mapAttrsToList (hostName: prom: {
job_name = hostName;
static_configs = [{
targets = [ "${hostName}.net.kittywit.ch:${toString prom.port}" ];
}];
}) prom_configs;
};
}