{ lib, config, machines, ... }: let cfg = config.lab.monitoring; status = code: "[STATUS] == ${toString code}"; bodyContains = text: "[BODY] == pat(*${text}*)"; maxResponseTime = ms: "[RESPONSE_TIME] < ${toString ms}"; machineEndpoints = lib.attrsets.mapAttrsToList (name: machine: let domain = if machine.isPhysical then "hyp" else "dmz"; in { name = "Host ${name}"; url = "icmp://${name}.${domain}"; conditions = [ "[RESPONSE_TIME] < 10" ]; }) machines; otherEndpoints = [ { name = "Forgejo"; url = "https://git.kun.is"; conditions = [ (status 200) (bodyContains "Forgejo: Beyond coding. We forge.") (maxResponseTime 750) ]; } { name = "Nextcloud"; url = "https://cloud.kun.is/status.php"; conditions = [ (status 200) "[BODY].installed == true" "[BODY].maintenance == false" "[BODY].needsDbUpgrade == false" (maxResponseTime 2000) ]; } { name = "Paperless-ngx"; url = "https://paperless.kun.is/accounts/login/"; conditions = [ (status 200) (bodyContains "Please sign in.") (maxResponseTime 750) ]; } { name = "Radicale"; url = "https://dav.kun.is/.web/"; conditions = [ (status 200) (bodyContains "Login") (maxResponseTime 750) ]; } { name = "FreshRSS"; url = "https://rss.kun.is/i/"; conditions = [ (status 200) (bodyContains "Login") (maxResponseTime 750) ]; } { name = "KitchenOwl"; url = "https://boodschappen.kun.is/signin"; conditions = [ (status 200) (bodyContains "