Unverified Commit 589ccfda authored by Martin Weinelt's avatar Martin Weinelt
Browse files

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.
parent 46b989f9
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -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"