nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/knot.nix
Martin Weinelt 589ccfdac1
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.
2023-10-23 13:19:52 +02:00

59 lines
1.5 KiB
Nix

{ config, lib, pkgs, options }:
with lib;
let
cfg = config.services.prometheus.exporters.knot;
in {
port = 9433;
extraOpts = {
knotLibraryPath = mkOption {
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`.
'';
};
knotSocketPath = mkOption {
type = types.str;
default = "/run/knot/knot.sock";
description = lib.mdDoc ''
Socket path of {manpage}`knotd(8)`.
'';
};
knotSocketTimeout = mkOption {
type = types.ints.positive;
default = 2000;
description = lib.mdDoc ''
Timeout in seconds.
'';
};
};
serviceOpts = {
path = with pkgs; [
procps
];
serviceConfig = {
ExecStart = ''
${pkgs.prometheus-knot-exporter}/bin/knot-exporter \
--web-listen-addr ${cfg.listenAddress} \
--web-listen-port ${toString cfg.port} \
--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"
];
RestrictAddressFamilies = [
# Need AF_UNIX to collect data
"AF_UNIX"
];
};
};
}