1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-03 06:19:10 +03:00
nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/kea.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.2 KiB
Nix
Raw Normal View History

2021-05-12 21:49:22 +02:00
{ config
, lib
, pkgs
, utils
, ...
2021-05-12 21:49:22 +02:00
}:
let
cfg = config.services.prometheus.exporters.kea;
inherit (lib)
mkOption
types
mkRenamedOptionModule
literalExpression
;
2021-05-12 21:49:22 +02:00
in {
imports = [
(mkRenamedOptionModule [ "controlSocketPaths" ] [ "targets" ])
];
2021-05-12 21:49:22 +02:00
port = 9547;
extraOpts = {
targets = mkOption {
2021-05-12 21:49:22 +02:00
type = types.listOf types.str;
example = literalExpression ''
2021-05-12 21:49:22 +02:00
[
"/run/kea/kea-dhcp4.socket"
"/run/kea/kea-dhcp6.socket"
"http://127.0.0.1:8547"
2021-05-12 21:49:22 +02:00
]
'';
description = ''
Paths or URLs to the Kea control socket.
2021-05-12 21:49:22 +02:00
'';
};
};
serviceOpts = {
after = [
"kea-dhcp4-server.service"
"kea-dhcp6-server.service"
];
2021-05-12 21:49:22 +02:00
serviceConfig = {
User = "kea";
DynamicUser = true;
ExecStart = utils.escapeSystemdExecArgs ([
(lib.getExe pkgs.prometheus-kea-exporter)
"--address" cfg.listenAddress
"--port" cfg.port
] ++ cfg.extraFlags ++ cfg.targets);
RuntimeDirectory = "kea";
RuntimeDirectoryPreserve = true;
RestrictAddressFamilies = [
# Need AF_UNIX to collect data
"AF_UNIX"
];
2021-05-12 21:49:22 +02:00
};
};
}