mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-26 08:48:38 +03:00
nixos/tests/kea: test ctrl-agent via kea-exporter
This commit is contained in:
parent
5b97e8d76d
commit
e4f6d1a618
@ -44,6 +44,11 @@ import ./make-test-python.nix ({ pkgs, lib, ...}: {
|
|||||||
name = "/var/lib/kea/dhcp4.leases";
|
name = "/var/lib/kea/dhcp4.leases";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
control-socket = {
|
||||||
|
socket-type = "unix";
|
||||||
|
socket-name = "/run/kea/dhcp4.sock";
|
||||||
|
};
|
||||||
|
|
||||||
interfaces-config = {
|
interfaces-config = {
|
||||||
dhcp-socket-type = "raw";
|
dhcp-socket-type = "raw";
|
||||||
interfaces = [
|
interfaces = [
|
||||||
@ -89,6 +94,25 @@ import ./make-test-python.nix ({ pkgs, lib, ...}: {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.kea.ctrl-agent = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
http-host = "127.0.0.1";
|
||||||
|
http-port = 8000;
|
||||||
|
control-sockets.dhcp4 = {
|
||||||
|
socket-type = "unix";
|
||||||
|
socket-name = "/run/kea/dhcp4.sock";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.prometheus.exporters.kea = {
|
||||||
|
enable = true;
|
||||||
|
controlSocketPaths = [
|
||||||
|
"http://127.0.0.1:8000"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nameserver = { config, pkgs, ... }: {
|
nameserver = { config, pkgs, ... }: {
|
||||||
@ -182,5 +206,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...}: {
|
|||||||
client.wait_until_succeeds("ping -c 5 10.0.0.1")
|
client.wait_until_succeeds("ping -c 5 10.0.0.1")
|
||||||
router.wait_until_succeeds("ping -c 5 10.0.0.3")
|
router.wait_until_succeeds("ping -c 5 10.0.0.3")
|
||||||
nameserver.wait_until_succeeds("kdig +short client.lan.nixos.test @10.0.0.2 | grep -q 10.0.0.3")
|
nameserver.wait_until_succeeds("kdig +short client.lan.nixos.test @10.0.0.2 | grep -q 10.0.0.3")
|
||||||
|
router.log(router.execute("curl 127.0.0.1:9547")[1])
|
||||||
|
router.succeed("curl --no-buffer 127.0.0.1:9547 | grep -qE '^kea_dhcp4_addresses_assigned_total.*1.0$'")
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, python3Packages
|
, python3Packages
|
||||||
, fetchPypi
|
, fetchPypi
|
||||||
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
python3Packages.buildPythonApplication rec {
|
python3Packages.buildPythonApplication rec {
|
||||||
@ -29,6 +30,10 @@ python3Packages.buildPythonApplication rec {
|
|||||||
$out/bin/kea-exporter --version | grep -q ${version}
|
$out/bin/kea-exporter --version | grep -q ${version}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests = {
|
||||||
|
inherit (nixosTests) kea;
|
||||||
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
changelog = "https://github.com/mweinelt/kea-exporter/blob/v${version}/HISTORY";
|
changelog = "https://github.com/mweinelt/kea-exporter/blob/v${version}/HISTORY";
|
||||||
description = "Export Kea Metrics in the Prometheus Exposition Format";
|
description = "Export Kea Metrics in the Prometheus Exposition Format";
|
||||||
|
Loading…
Reference in New Issue
Block a user