dns: Add prometheus exporter

23.11
Simon Bruder 2023-10-26 01:18:17 +02:00
parent bfec11bb29
commit af1d41ffda
Signed by: simon
GPG Key ID: 8D3C82F9F309F8EC
2 changed files with 32 additions and 0 deletions

View File

@ -123,6 +123,18 @@ in
replacement = "vueko.sbruder.de";
};
}
{
job_name = "knot";
static_configs = mkStaticTargets [
"okarin.vpn.sbruder.de:9433"
"vueko.vpn.sbruder.de:9433"
];
relabel_configs = lib.singleton {
target_label = "instance";
source_labels = lib.singleton "__address__";
regex = "(.*)\\.vpn\\.sbruder\\.de:9433";
};
}
];
rules =

View File

@ -41,6 +41,15 @@ in
log:
- target: syslog
any: info
mod-stats:
- id: custom
edns-presence: on
flag-presence: on
query-size: on
query-type: on
reply-size: on
remote:
${lib.concatStrings (lib.mapAttrsToList (host: hostAddresses: ''
- id: ${host}
@ -70,6 +79,8 @@ in
# dnssec
dnssec-signing: on
dnssec-policy: default
# stats
module: mod-stats/custom
- id: nix-generated
storage: /var/lib/knot/nix-zones/
semantic-checks: on
@ -77,6 +88,8 @@ in
zonefile-sync: -1
zonefile-load: difference-no-serial
journal-content: all
# stats
module: mod-stats/custom
zone:
${lib.concatMapStrings (domain: ''
@ -93,6 +106,8 @@ in
- id: default
master: [${primaryHost}]
acl: [primary_notify]
# stats
module: mod-stats/custom
'');
};
@ -167,6 +182,11 @@ in
allowedUDPPorts = [ 53 ];
};
services.prometheus.exporters.knot = {
enable = true;
listenAddress = config.sbruder.wireguard.home.address;
};
assertions = [
{
assertion = isPrimaryHost -> (lib.hasAttr "vpn.sbruder.de" cfg.generated-zones);