From bd6f16cd4f10f2029913110562dd0be53cbc34c2 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Sat, 1 Jun 2024 14:57:57 -0700 Subject: [PATCH] chore(monitoring): separate external machines --- modules/system/access.nix | 19 ++++++++++++++----- modules/system/exports/monitoring.nix | 2 +- nixos/monitoring/gatus.nix | 5 ++++- systems/u7pro/default.nix | 5 ++++- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/modules/system/access.nix b/modules/system/access.nix index 88f9b5f5..424222a3 100644 --- a/modules/system/access.nix +++ b/modules/system/access.nix @@ -206,11 +206,20 @@ in { default = domain; }; global.enable = mkEnableOption "globally routeable"; - online.enable = - mkEnableOption "a deployed machine" - // { - default = true; - }; + online = let + proxmoxNodeAccess = systems.${config.proxmox.node.name}.config.access; + in { + enable = + mkEnableOption "a deployed machine" + // { + default = true; + }; + available = + mkEnableOption "always on machine" + // { + default = cfg.online.enable && (config.type == "NixOS" || config.proxmox.node.enable || (config.proxmox.vm.enable && proxmoxNodeAccess.online.available)); + }; + }; hostnameForNetwork = mkOption { type = attrsOf str; default = {}; diff --git a/modules/system/exports/monitoring.nix b/modules/system/exports/monitoring.nix index 5eb6d119..82b6c107 100644 --- a/modules/system/exports/monitoring.nix +++ b/modules/system/exports/monitoring.nix @@ -249,7 +249,7 @@ in enable = mkEnableOption "health check alerts" // { - default = config.access.online.enable && config.type == "NixOS"; + default = config.access.online.enable && config.access.online.available; }; }; services = mkOption { diff --git a/nixos/monitoring/gatus.nix b/nixos/monitoring/gatus.nix index 11ed0495..12a3b449 100644 --- a/nixos/monitoring/gatus.nix +++ b/nixos/monitoring/gatus.nix @@ -157,12 +157,15 @@ }; groups = { services = "Services"; + servers = "${groups.systems}/Servers"; systems = "Systems"; forSystem = system: let node = systems.${system.config.proxmox.node.name}.config; in if system.config.proxmox.enabled - then "${groups.systems}/${node.name}" + then "${groups.servers}/${node.name}" + else if system.config.access.online.available + then groups.servers else groups.systems; }; in { diff --git a/systems/u7pro/default.nix b/systems/u7pro/default.nix index 28247db0..596d0ed2 100644 --- a/systems/u7pro/default.nix +++ b/systems/u7pro/default.nix @@ -1,6 +1,9 @@ _: { type = "Linux"; - access.hostName = "u7-pro"; + access = { + hostName = "u7-pro"; + online.available = true; + }; network.networks = { local = { address4 = "10.1.1.3";