From 7f9742089bb908f2a04ae38ae94b9d8c33cd9484 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 4 Jun 2023 23:06:53 +0200 Subject: [PATCH] cluster/services/monitoring: make blackbox targets configurable through cluster config --- cluster/services/monitoring/blackbox.nix | 7 +------ cluster/services/monitoring/default.nix | 4 ++++ cluster/services/monitoring/options.nix | 25 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 cluster/services/monitoring/options.nix diff --git a/cluster/services/monitoring/blackbox.nix b/cluster/services/monitoring/blackbox.nix index fac2d2b..cb4fb05 100644 --- a/cluster/services/monitoring/blackbox.nix +++ b/cluster/services/monitoring/blackbox.nix @@ -68,12 +68,7 @@ in }; }; blackbox_targets = let - regularTargets = mapTargets { - web = { - module = "https2xx"; - address = "https://www.${domain}"; - }; - }; + regularTargets = mapTargets cluster.config.monitoring.blackbox.targets; secretTargets = mkSecretTargets 1; in regularTargets ++ secretTargets; }; diff --git a/cluster/services/monitoring/default.nix b/cluster/services/monitoring/default.nix index 7de69f3..029690b 100644 --- a/cluster/services/monitoring/default.nix +++ b/cluster/services/monitoring/default.nix @@ -9,6 +9,10 @@ let in { + imports = [ + ./options.nix + ]; + links = { loki-ingest = { protocol = "http"; diff --git a/cluster/services/monitoring/options.nix b/cluster/services/monitoring/options.nix new file mode 100644 index 0000000..bce4a37 --- /dev/null +++ b/cluster/services/monitoring/options.nix @@ -0,0 +1,25 @@ +{ lib, ... }: +with lib; + +{ + options.monitoring = { + blackbox = { + targets = mkOption { + description = "Blackbox targets to be monitored by the cluster."; + default = {}; + type = with types; attrsOf (submodule ({ ... }: { + options = { + module = mkOption { + description = "The Blackbox module to use."; + type = types.str; + }; + address = mkOption { + description = "The target's address."; + type = types.str; + }; + }; + })); + }; + }; + }; +}