Merge pull request #91663 from mweinelt/kea-exporter
prometheus-kea-exporter: init at 0.4.1wip/little-gl
commit
94b2848559
@ -0,0 +1,38 @@ |
||||
{ config |
||||
, lib |
||||
, pkgs |
||||
, options |
||||
}: |
||||
|
||||
with lib; |
||||
|
||||
let |
||||
cfg = config.services.prometheus.exporters.kea; |
||||
in { |
||||
port = 9547; |
||||
extraOpts = { |
||||
controlSocketPaths = mkOption { |
||||
type = types.listOf types.str; |
||||
example = literalExample '' |
||||
[ |
||||
"/run/kea/kea-dhcp4.socket" |
||||
"/run/kea/kea-dhcp6.socket" |
||||
] |
||||
''; |
||||
description = '' |
||||
Paths to kea control sockets |
||||
''; |
||||
}; |
||||
}; |
||||
serviceOpts = { |
||||
serviceConfig = { |
||||
ExecStart = '' |
||||
${pkgs.prometheus-kea-exporter}/bin/kea-exporter \ |
||||
--address ${cfg.listenAddress} \ |
||||
--port ${toString cfg.port} \ |
||||
${concatStringsSep " \\n" cfg.controlSocketPaths} |
||||
''; |
||||
SupplementaryGroups = [ "kea" ]; |
||||
}; |
||||
}; |
||||
} |
@ -0,0 +1,33 @@ |
||||
{ lib, python3Packages, nixosTests }: |
||||
|
||||
python3Packages.buildPythonApplication rec { |
||||
pname = "kea-exporter"; |
||||
version = "0.4.2"; |
||||
|
||||
src = python3Packages.fetchPypi { |
||||
inherit pname version; |
||||
sha256 = "0dpzicv0ksyda2lprldkj452c23qycl5c9avca6x7f7rbqry9pnd"; |
||||
}; |
||||
|
||||
propagatedBuildInputs = with python3Packages; [ |
||||
click |
||||
prometheus_client |
||||
]; |
||||
|
||||
checkPhase = '' |
||||
$out/bin/kea-exporter --help > /dev/null |
||||
$out/bin/kea-exporter --version | grep -q ${version} |
||||
''; |
||||
|
||||
passthru.tests = { |
||||
inherit (nixosTests.prometheus-exporters) kea; |
||||
}; |
||||
|
||||
meta = with lib; { |
||||
description = "Export Kea Metrics in the Prometheus Exposition Format"; |
||||
homepage = "https://github.com/mweinelt/kea-exporter"; |
||||
license = licenses.mit; |
||||
maintainers = with maintainers; [ hexa ]; |
||||
}; |
||||
} |
||||
|
Loading…
Reference in new issue