summary refs log tree commit diff
path: root/nixos/tests/prometheus-exporters.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-05-03 17:01:13 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2021-05-03 17:27:36 +0200
commit75c5a703ab06d9267cd3aa8938c9e4b0706a9125 (patch)
treee7e145dafea5de0a79c2caa933ebf661c8cf2041 /nixos/tests/prometheus-exporters.nix
parent040f0acccdf342e6ca59d84b6d1030da34096072 (diff)
downloadnixpkgs-75c5a703ab06d9267cd3aa8938c9e4b0706a9125.tar
nixpkgs-75c5a703ab06d9267cd3aa8938c9e4b0706a9125.tar.gz
nixpkgs-75c5a703ab06d9267cd3aa8938c9e4b0706a9125.tar.bz2
nixpkgs-75c5a703ab06d9267cd3aa8938c9e4b0706a9125.tar.lz
nixpkgs-75c5a703ab06d9267cd3aa8938c9e4b0706a9125.tar.xz
nixpkgs-75c5a703ab06d9267cd3aa8938c9e4b0706a9125.tar.zst
nixpkgs-75c5a703ab06d9267cd3aa8938c9e4b0706a9125.zip
prometheus-knot-exporter: add patch to fix stats
This is a patch I filed against upstream[1] a while ago. As it isn't
merged yet and fixes configurations with all stats enabled in knot
(otherwise it'd crash when sending a request to `localhost:9433`), I
decided that it makes sense to add it to the package directly.

I extended the test to make sure that it only passes with this patch.

[1] https://github.com/ghedo/knot_exporter/pull/6
Diffstat (limited to 'nixos/tests/prometheus-exporters.nix')
-rw-r--r--nixos/tests/prometheus-exporters.nix37
1 files changed, 36 insertions, 1 deletions
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix
index 21419c0d081..2b17d0ff78f 100644
--- a/nixos/tests/prometheus-exporters.nix
+++ b/nixos/tests/prometheus-exporters.nix
@@ -334,13 +334,48 @@ let
         services.knot = {
           enable = true;
           extraArgs = [ "-v" ];
+          extraConfig = ''
+            server:
+              listen: 127.0.0.1@53
+
+            template:
+              - id: default
+                global-module: mod-stats
+                dnssec-signing: off
+                zonefile-sync: -1
+                journal-db: /var/lib/knot/journal
+                kasp-db: /var/lib/knot/kasp
+                timer-db: /var/lib/knot/timer
+                zonefile-load: difference
+                storage: ${pkgs.buildEnv {
+                  name = "foo";
+                  paths = [
+                    (pkgs.writeTextDir "test.zone" ''
+                      @ SOA ns.example.com. noc.example.com. 2019031301 86400 7200 3600000 172800
+                      @       NS      ns1
+                      @       NS      ns2
+                      ns1     A       192.168.0.1
+                    '')
+                  ];
+                }}
+
+            mod-stats:
+              - id: custom
+                edns-presence: on
+                query-type: on
+
+            zone:
+              - domain: test
+                file: test.zone
+                module: mod-stats/custom
+          '';
         };
       };
       exporterTest = ''
         wait_for_unit("knot.service")
         wait_for_unit("prometheus-knot-exporter.service")
         wait_for_open_port(9433)
-        succeed("curl -sSf 'localhost:9433' | grep -q 'knot_server_zone_count 0.0'")
+        succeed("curl -sSf 'localhost:9433' | grep -q 'knot_server_zone_count 1.0'")
       '';
     };