From d3354f4276a55a45717121f1e979240e779301a1 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 8 Apr 2022 16:51:43 +0200 Subject: ... --- hosts/surtr/dns/default.nix | 2 +- hosts/vidhar/prometheus/default.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'hosts') diff --git a/hosts/surtr/dns/default.nix b/hosts/surtr/dns/default.nix index 28e0df73..d2ad0bb6 100644 --- a/hosts/surtr/dns/default.nix +++ b/hosts/surtr/dns/default.nix @@ -207,7 +207,7 @@ in { settings = { server = { - interface = ["lo"]; + interface = ["lo@5353"]; prefer-ip6 = true; access-control = ["127.0.0.0/8 allow" "::1/128 allow"]; root-hints = "${pkgs.dns-root-data}/root.hints"; 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