summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2023-09-29 16:43:26 +0200
committerMartin Weinelt <hexa@darmstadt.ccc.de>2023-10-23 13:19:52 +0200
commit589ccfdac1ec6ae0e38f4f253f69be50c8713e1b (patch)
tree4128adad218e71edf3e03ab69293d3e19896040a /nixos
parent46b989f924f4d0f450ec1948b2de99293d563669 (diff)
downloadnixpkgs-589ccfdac1ec6ae0e38f4f253f69be50c8713e1b.tar
nixpkgs-589ccfdac1ec6ae0e38f4f253f69be50c8713e1b.tar.gz
nixpkgs-589ccfdac1ec6ae0e38f4f253f69be50c8713e1b.tar.bz2
nixpkgs-589ccfdac1ec6ae0e38f4f253f69be50c8713e1b.tar.lz
nixpkgs-589ccfdac1ec6ae0e38f4f253f69be50c8713e1b.tar.xz
nixpkgs-589ccfdac1ec6ae0e38f4f253f69be50c8713e1b.tar.zst
nixpkgs-589ccfdac1ec6ae0e38f4f253f69be50c8713e1b.zip
nixos/prometheus-exporters/knot: update for new exporter
The new exporter has proper console scripts definition, that sets up
another executable name.

The package now also shells out to pidof, which is why we require procps
in the unit PATH.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/knot.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/knot.nix b/nixos/modules/services/monitoring/prometheus/exporters/knot.nix
index a73425b37da..77584875080 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/knot.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/knot.nix
@@ -8,9 +8,9 @@ in {
   port = 9433;
   extraOpts = {
     knotLibraryPath = mkOption {
-      type = types.str;
-      default = "${pkgs.knot-dns.out}/lib/libknot.so";
-      defaultText = literalExpression ''"''${pkgs.knot-dns.out}/lib/libknot.so"'';
+      type = types.nullOr types.str;
+      default = null;
+      example = literalExpression ''"''${pkgs.knot-dns.out}/lib/libknot.so"'';
       description = lib.mdDoc ''
         Path to the library of `knot-dns`.
       '';
@@ -25,7 +25,7 @@ in {
     };
 
     knotSocketTimeout = mkOption {
-      type = types.int;
+      type = types.ints.positive;
       default = 2000;
       description = lib.mdDoc ''
         Timeout in seconds.
@@ -33,17 +33,22 @@ in {
     };
   };
   serviceOpts = {
+    path = with pkgs; [
+      procps
+    ];
     serviceConfig = {
       ExecStart = ''
-        ${pkgs.prometheus-knot-exporter}/bin/knot_exporter \
+        ${pkgs.prometheus-knot-exporter}/bin/knot-exporter \
           --web-listen-addr ${cfg.listenAddress} \
           --web-listen-port ${toString cfg.port} \
-          --knot-library-path ${cfg.knotLibraryPath} \
           --knot-socket-path ${cfg.knotSocketPath} \
           --knot-socket-timeout ${toString cfg.knotSocketTimeout} \
+          ${lib.optionalString (cfg.knotLibraryPath != null) "--knot-library-path ${cfg.knotLibraryPath}"} \
           ${concatStringsSep " \\\n  " cfg.extraFlags}
       '';
-      SupplementaryGroups = [ "knot" ];
+      SupplementaryGroups = [
+        "knot"
+      ];
       RestrictAddressFamilies = [
         # Need AF_UNIX to collect data
         "AF_UNIX"