dns: Add prometheus exporter

This commit is contained in:
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"; 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 = rules =

View file

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