Format repo

This commit is contained in:
Pim Kunis 2024-10-28 14:12:06 +01:00
parent eed797fb13
commit 5341235bc3
21 changed files with 1200 additions and 1076 deletions

View file

@ -1,8 +1,11 @@
{ lib, config, machines, ... }:
let
cfg = config.lab.monitoring;
in
{
lib,
config,
machines,
...
}: let
cfg = config.lab.monitoring;
in {
options = {
lab.monitoring = {
enable = lib.mkOption {
@ -18,8 +21,9 @@ in
};
config = lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ config.services.prometheus.exporters.node.port ]
++ lib.lists.optionals cfg.server.enable [ 80 ];
networking.firewall.allowedTCPPorts =
[config.services.prometheus.exporters.node.port]
++ lib.lists.optionals cfg.server.enable [80];
services.prometheus = {
enable = cfg.server.enable;
@ -32,12 +36,15 @@ in
scrapeConfigs = lib.mkIf cfg.server.enable (
let
generated = lib.attrsets.mapAttrsToList
generated =
lib.attrsets.mapAttrsToList
(name: machine: {
job_name = name;
static_configs = [{
targets = [ "${name}.dmz:${toString config.services.prometheus.exporters.node.port}" ];
}];
static_configs = [
{
targets = ["${name}.dmz:${toString config.services.prometheus.exporters.node.port}"];
}
];
})
machines;
@ -53,12 +60,14 @@ in
password = "admin";
};
static_configs = [{
targets = [ "pikvm.dmz" ];
}];
static_configs = [
{
targets = ["pikvm.dmz"];
}
];
};
in
generated ++ [ pikvm ]
generated ++ [pikvm]
);
};