2024-04-20 14:37:31 +02:00
|
|
|
{
|
2024-04-23 22:02:04 +02:00
|
|
|
config,
|
2024-04-20 14:37:31 +02:00
|
|
|
lib,
|
2024-12-08 22:31:14 +01:00
|
|
|
serverNodes,
|
2024-04-20 14:37:31 +02:00
|
|
|
sources,
|
|
|
|
...
|
|
|
|
}:
|
2024-03-28 16:25:29 +01:00
|
|
|
let
|
2024-04-23 22:02:04 +02:00
|
|
|
inherit (lib)
|
|
|
|
concatLists
|
|
|
|
mapAttrsToList
|
|
|
|
mkForce
|
|
|
|
mkMerge
|
|
|
|
;
|
|
|
|
|
2024-04-20 14:37:31 +02:00
|
|
|
inherit (config.statelessUptimeKuma.lib)
|
|
|
|
pingProbesFromHive
|
|
|
|
fromHive
|
|
|
|
httpProbesFromConfig
|
|
|
|
probesWithTag
|
|
|
|
;
|
2024-04-23 22:02:04 +02:00
|
|
|
|
|
|
|
probesCfg = config.statelessUptimeKuma.probesConfig;
|
|
|
|
|
|
|
|
mkMonitors = name: builtins.attrNames (probesWithTag { inherit name; } probesCfg);
|
|
|
|
|
2024-03-28 16:25:29 +01:00
|
|
|
host = "status.dgnum.eu";
|
|
|
|
|
|
|
|
port = 3001;
|
2024-04-20 14:37:31 +02:00
|
|
|
|
2024-12-08 16:38:29 +01:00
|
|
|
httpExcludes =
|
|
|
|
[
|
|
|
|
"localhost"
|
|
|
|
"ens.cal.dgnum.eu"
|
|
|
|
"luj-current.cal.dgnum.eu"
|
|
|
|
"s3.dgnum.eu"
|
|
|
|
"cdn.dgnum.eu"
|
|
|
|
"saml-idp.dgnum.eu"
|
|
|
|
"status.dgnum.eu"
|
|
|
|
"radius.dgnum.eu"
|
|
|
|
]
|
|
|
|
++ (concatLists (mapAttrsToList (_: { config, ... }: config.dgn-redirections.retired) serverNodes));
|
2024-04-20 14:37:31 +02:00
|
|
|
|
|
|
|
extraProbes = {
|
|
|
|
monitors = {
|
|
|
|
"prometheus.dgnum.eu" = {
|
2024-04-23 22:02:04 +02:00
|
|
|
type = mkForce "http";
|
2024-04-20 14:37:31 +02:00
|
|
|
accepted_statuscodes = [ "401" ];
|
|
|
|
};
|
2024-04-23 22:02:04 +02:00
|
|
|
|
2024-10-21 12:25:18 +02:00
|
|
|
"ollama01.beta.dgnum.eu" = {
|
2024-10-21 12:15:44 +02:00
|
|
|
type = mkForce "http";
|
|
|
|
accepted_statuscodes = [ "401" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"s3-admin.dgnum.eu" = {
|
|
|
|
type = mkForce "http";
|
|
|
|
accepted_statuscodes = [ "400" ];
|
|
|
|
};
|
|
|
|
|
2024-04-20 14:37:31 +02:00
|
|
|
"api.meet.dgnum.eu" = {
|
|
|
|
keyword = "Crab Fit API";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
status_pages = {
|
|
|
|
"dgnum" = {
|
|
|
|
title = "DGNum";
|
|
|
|
description = "Etat de l'infra de la DGNum";
|
|
|
|
showTags = true;
|
|
|
|
publicGroupList = [
|
|
|
|
{
|
|
|
|
name = "Services";
|
|
|
|
weight = 1;
|
2024-04-23 22:02:04 +02:00
|
|
|
monitorList = mkMonitors "Service";
|
2024-04-20 14:37:31 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Serveurs";
|
|
|
|
weight = 2;
|
2024-04-23 22:02:04 +02:00
|
|
|
monitorList = mkMonitors "Ping";
|
2024-04-20 14:37:31 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "VPN Interne";
|
|
|
|
weight = 2;
|
2024-04-23 22:02:04 +02:00
|
|
|
monitorList = mkMonitors "VPN";
|
2024-04-20 14:37:31 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
pingProbes = pingProbesFromHive {
|
2024-12-08 16:38:29 +01:00
|
|
|
nodes = serverNodes;
|
2024-04-20 14:37:31 +02:00
|
|
|
mkHost = _: config: config.networking.fqdn;
|
|
|
|
tags = [ { name = "Ping"; } ];
|
|
|
|
excludes = [
|
|
|
|
"geo01"
|
|
|
|
"geo02"
|
|
|
|
"rescue01"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
vpnProbes = pingProbesFromHive {
|
2024-12-08 16:38:29 +01:00
|
|
|
nodes = serverNodes;
|
2024-04-20 14:37:31 +02:00
|
|
|
prefix = "VPN - ";
|
|
|
|
mkHost = node: _: "${node}.dgnum";
|
|
|
|
tags = [ { name = "VPN"; } ];
|
|
|
|
excludes = [
|
|
|
|
"rescue01"
|
|
|
|
"web02"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
httpProbes = fromHive {
|
2024-12-08 16:38:29 +01:00
|
|
|
nodes = serverNodes;
|
2024-04-20 14:37:31 +02:00
|
|
|
builder =
|
|
|
|
_: module:
|
|
|
|
httpProbesFromConfig {
|
|
|
|
inherit (module) config;
|
|
|
|
tags = [
|
|
|
|
{
|
|
|
|
name = "Host";
|
|
|
|
value = module.config.networking.fqdn;
|
|
|
|
}
|
|
|
|
{ name = "Service"; }
|
|
|
|
];
|
|
|
|
excludes = httpExcludes;
|
|
|
|
};
|
|
|
|
};
|
2024-03-28 16:25:29 +01:00
|
|
|
in
|
|
|
|
{
|
2024-04-20 14:37:31 +02:00
|
|
|
imports = [ (sources.stateless-uptime-kuma + "/nixos/module.nix") ];
|
|
|
|
nixpkgs.overlays = [ (import (sources.stateless-uptime-kuma + "/overlay.nix")) ];
|
2024-04-23 22:02:04 +02:00
|
|
|
|
2024-03-28 16:25:29 +01:00
|
|
|
services.uptime-kuma.enable = true;
|
|
|
|
|
2024-10-12 19:30:36 +02:00
|
|
|
dgn-web.simpleProxies.uptime-kuma = {
|
|
|
|
inherit host port;
|
|
|
|
proxyWebsockets = true;
|
2024-03-28 16:25:29 +01:00
|
|
|
};
|
|
|
|
|
2024-04-20 14:37:31 +02:00
|
|
|
statelessUptimeKuma = {
|
2024-04-23 22:02:04 +02:00
|
|
|
probesConfig = mkMerge [
|
2024-04-20 14:37:31 +02:00
|
|
|
pingProbes
|
|
|
|
httpProbes
|
|
|
|
extraProbes
|
|
|
|
vpnProbes
|
|
|
|
{ inherit status_pages; }
|
|
|
|
];
|
2024-04-23 22:02:04 +02:00
|
|
|
|
|
|
|
extraFlags = [ "-s" ];
|
|
|
|
|
2024-04-20 14:37:31 +02:00
|
|
|
host = "http://localhost:${builtins.toString port}/";
|
|
|
|
username = "dgnum";
|
|
|
|
passwordFile = config.age.secrets."stateless-uptime-kuma-password".path;
|
|
|
|
enableService = true;
|
|
|
|
};
|
2024-03-28 16:25:29 +01:00
|
|
|
}
|