From d3354f4276a55a45717121f1e979240e779301a1 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 8 Apr 2022 16:51:43 +0200 Subject: ... --- hosts/vidhar/prometheus/default.nix | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'hosts/vidhar/prometheus') diff --git a/hosts/vidhar/prometheus/default.nix b/hosts/vidhar/prometheus/default.nix index 0bf1ca58..2c9831e5 100644 --- a/hosts/vidhar/prometheus/default.nix +++ b/hosts/vidhar/prometheus/default.nix @@ -80,6 +80,20 @@ in { "--collector.unit-whitelist=(dhcpcd-dsl|pppd-telekom|corerad|ndppd)\.service" ]; }; + blackbox = { + enable = true; + configFile = pkgs.writeText "blackbox-config.yaml" (builtins.toJSON { + modules = { + "dns_soa" = { + prober = "dns"; + dns = { + query_name = "."; + query_type = "SOA"; + }; + }; + }; + }); + }; }; globalConfig = { @@ -201,6 +215,25 @@ in { relabel_configs = relabelHosts; scrape_interval = "5s"; } + { job_name = "blackbox"; + metrics_path = "/probe"; + params = { module = ["dns_soa"]; }; + static_configs = [ + { targets = ["127.0.0.53:53" "127.0.0.1:5353"]; } + ]; + relabel_configs = [ + { source_labels = ["__address__"]; + target_label = "__param_target"; + } + { source_labels = ["__param_target"]; + target_label = "instance"; + } + { replacement = "localhost:${toString config.services.prometheus.exporters.blackbox.port}"; + target_label = "__address__"; + } + ]; + scrape_interval = "5s"; + } ]; rules = [ -- cgit v1.2.3