2021-05-12 21:49:22 +02:00
|
|
|
{ config
|
|
|
|
, lib
|
|
|
|
, pkgs
|
2024-03-21 06:16:33 +01:00
|
|
|
, utils
|
2024-03-21 05:26:03 +01:00
|
|
|
, ...
|
2021-05-12 21:49:22 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.prometheus.exporters.kea;
|
2024-04-24 14:41:17 -04:00
|
|
|
inherit (lib)
|
|
|
|
mkOption
|
|
|
|
types
|
|
|
|
mkRenamedOptionModule
|
|
|
|
literalExpression
|
|
|
|
;
|
2021-05-12 21:49:22 +02:00
|
|
|
in {
|
2024-03-21 06:16:33 +01:00
|
|
|
imports = [
|
|
|
|
(mkRenamedOptionModule [ "controlSocketPaths" ] [ "targets" ])
|
|
|
|
];
|
2021-05-12 21:49:22 +02:00
|
|
|
port = 9547;
|
|
|
|
extraOpts = {
|
2024-03-21 06:16:33 +01:00
|
|
|
targets = mkOption {
|
2021-05-12 21:49:22 +02:00
|
|
|
type = types.listOf types.str;
|
2021-10-03 18:06:03 +02:00
|
|
|
example = literalExpression ''
|
2021-05-12 21:49:22 +02:00
|
|
|
[
|
2023-12-15 13:51:19 +01:00
|
|
|
"/run/kea/kea-dhcp4.socket"
|
|
|
|
"/run/kea/kea-dhcp6.socket"
|
2024-03-21 06:16:33 +01:00
|
|
|
"http://127.0.0.1:8547"
|
2021-05-12 21:49:22 +02:00
|
|
|
]
|
|
|
|
'';
|
|
|
|
description = ''
|
2024-03-21 06:16:33 +01:00
|
|
|
Paths or URLs to the Kea control socket.
|
2021-05-12 21:49:22 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
serviceOpts = {
|
2022-03-17 03:27:21 +01:00
|
|
|
after = [
|
|
|
|
"kea-dhcp4-server.service"
|
|
|
|
"kea-dhcp6-server.service"
|
|
|
|
];
|
2021-05-12 21:49:22 +02:00
|
|
|
serviceConfig = {
|
2021-07-12 01:36:50 +02:00
|
|
|
User = "kea";
|
2023-12-26 21:41:34 +01:00
|
|
|
DynamicUser = true;
|
2024-03-21 06:16:33 +01:00
|
|
|
ExecStart = utils.escapeSystemdExecArgs ([
|
|
|
|
(lib.getExe pkgs.prometheus-kea-exporter)
|
|
|
|
"--address" cfg.listenAddress
|
|
|
|
"--port" cfg.port
|
|
|
|
] ++ cfg.extraFlags ++ cfg.targets);
|
2023-12-26 21:41:34 +01:00
|
|
|
RuntimeDirectory = "kea";
|
|
|
|
RuntimeDirectoryPreserve = true;
|
2021-08-08 16:48:49 +02:00
|
|
|
RestrictAddressFamilies = [
|
|
|
|
# Need AF_UNIX to collect data
|
|
|
|
"AF_UNIX"
|
|
|
|
];
|
2021-05-12 21:49:22 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|