fix(rescue01): Filter nodes to only include real servers

This commit is contained in:
Tom Hubrecht 2024-12-08 16:38:29 +01:00
parent a2295953da
commit 715201abc2
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc

View file

@ -1,6 +1,7 @@
{ {
config, config,
lib, lib,
meta,
nodes, nodes,
sources, sources,
... ...
@ -8,6 +9,7 @@
let let
inherit (lib) inherit (lib)
concatLists concatLists
filterAttrs
mapAttrsToList mapAttrsToList
mkForce mkForce
mkMerge mkMerge
@ -20,6 +22,8 @@ let
probesWithTag probesWithTag
; ;
serverNodes = filterAttrs (name: _: meta.nodes.${name}.nixpkgs.system == "nixos") nodes;
probesCfg = config.statelessUptimeKuma.probesConfig; probesCfg = config.statelessUptimeKuma.probesConfig;
mkMonitors = name: builtins.attrNames (probesWithTag { inherit name; } probesCfg); mkMonitors = name: builtins.attrNames (probesWithTag { inherit name; } probesCfg);
@ -28,7 +32,8 @@ let
port = 3001; port = 3001;
httpExcludes = [ httpExcludes =
[
"localhost" "localhost"
"ens.cal.dgnum.eu" "ens.cal.dgnum.eu"
"luj-current.cal.dgnum.eu" "luj-current.cal.dgnum.eu"
@ -37,7 +42,8 @@ let
"saml-idp.dgnum.eu" "saml-idp.dgnum.eu"
"status.dgnum.eu" "status.dgnum.eu"
"radius.dgnum.eu" "radius.dgnum.eu"
] ++ (concatLists (mapAttrsToList (_: { config, ... }: config.dgn-redirections.retired) nodes)); ]
++ (concatLists (mapAttrsToList (_: { config, ... }: config.dgn-redirections.retired) serverNodes));
extraProbes = { extraProbes = {
monitors = { monitors = {
@ -88,7 +94,7 @@ let
}; };
pingProbes = pingProbesFromHive { pingProbes = pingProbesFromHive {
inherit nodes; nodes = serverNodes;
mkHost = _: config: config.networking.fqdn; mkHost = _: config: config.networking.fqdn;
tags = [ { name = "Ping"; } ]; tags = [ { name = "Ping"; } ];
excludes = [ excludes = [
@ -99,7 +105,7 @@ let
}; };
vpnProbes = pingProbesFromHive { vpnProbes = pingProbesFromHive {
inherit nodes; nodes = serverNodes;
prefix = "VPN - "; prefix = "VPN - ";
mkHost = node: _: "${node}.dgnum"; mkHost = node: _: "${node}.dgnum";
tags = [ { name = "VPN"; } ]; tags = [ { name = "VPN"; } ];
@ -110,7 +116,7 @@ let
}; };
httpProbes = fromHive { httpProbes = fromHive {
inherit nodes; nodes = serverNodes;
builder = builder =
_: module: _: module:
httpProbesFromConfig { httpProbesFromConfig {