[Kea-users] statistics-get - computation of # of current leases per pool?
Václav Ovsík
vaclav.ovsik at seznam.cz
Fri Oct 30 12:06:35 UTC 2026
Dear Darren,
You are absolutely right! :-D
Thank you very much.
# git diff
diff --git a/kea/kea-dhcp4.conf b/kea/kea-dhcp4.conf
index cefb91f..f3843a8 100644
--- a/kea/kea-dhcp4.conf
+++ b/kea/kea-dhcp4.conf
@@ -707,7 +707,7 @@
{ "name": "routers", "data": "10.8.160.129" },
{ "name": "log-servers", "data": "10.0.156.82, 10.0.156.83" } // nms1, nms2
],
- "pools": [ { "pool": "10.8.160.242 - 10.8.160.250" } ]
+ "pools": [ { "pool-id": 1, "pool": "10.8.160.242 - 10.8.160.250" } ]
},
// IIT-Test
# echo '{ "command": "statistic-get", "arguments": { "name": "subnet[80].assigned-addresses" } }' | socat UNIX-CONNECT:/run/kea/kea4-ctrl-socket STDIO | jq '.arguments'
{
"subnet[80].assigned-addresses": [
[
9,
"2026-10-30 12:33:17.128110"
],
[
0,
"2026-10-30 12:33:17.127928"
]
]
}
# echo '{ "command": "statistic-get", "arguments": { "name": "subnet[80].pool[0].assigned-addresses" } }' | socat UNIX-CONNECT:/run/kea/kea4-ctrl-socket STDIO | jq '.arguments'
{
"subnet[80].pool[0].assigned-addresses": [
[
9,
"2026-10-30 12:33:17.128139"
]
]
}
# echo '{ "command": "statistic-get", "arguments": { "name": "subnet[80].pool[1].assigned-addresses" } }' | socat UNIX-CONNECT:/run/kea/kea4-ctrl-socket STDIO | jq '.arguments'
{
"subnet[80].pool[1].assigned-addresses": [
[
0,
"2026-10-30 12:33:17.127938"
]
]
}
The plugin have to be modified, because it has problem with pool-id.
I want to live with CheckMK monitoring for now but thanks for link to stork.
Best Regards!
--
Zito
On Thu, Oct 29, 2026 at 05:07:27PM -0400, Darren Ankney wrote:
> Hi Zito,
>
> First I would say that you might want to take a look at Stork
> (https://www.isc.org/stork/) which would allow export to grafana via
> prometheus (and shows its own stats as well). Open source software
> (https://gitlab.isc.org/isc-projects/stork). An easy way to get
> started: https://kb.isc.org/docs/stork-quickstart-guide
>
> I believe this is by design. Here:
> https://kea.readthedocs.io/en/kea-3.0.4/arm/dhcp4-srv.html#statistics-in-the-dhcpv4-server
> there is a table that describes each statistic. I believe that
> pool[0] is the entire subnet. There is a note following that table
> that describes the pool-id. I believe, that if you configure a
> pool-id greater than 0 in your subnet that you will get proper pool
> statistics that don't include the entire subnet's assigned addresses
> (assuming you ask for that specific pool-id in the API call).
>
> Thank you,
> Darren Ankney
>
> On Thu, Oct 29, 2026 at 1:34 PM Václav Ovsík <vaclav.ovsik at seznam.cz> wrote:
> >
> > Fellow users of KEA,
> >
> > I'm trying to migrate from ISC dhcpd to KEA. The current dhcpd server
> > installations are working in HA load balancing mode and I decided to
> > use HA hot-standby mode for KEA (according to documentation).
> > The servers are running Debian 13 Trixie and KEA from trixie-backports version
> > 3.0.3-1~bpo13+1.
> >
> > Along the KEA replacement I also install monitoring plugin for KEA in
> > CheckMK (https://codeberg.org/mirabilos/kea-dhcp). It monitors pools
> > usage by asking the KEA, but I have problem with the results.
> >
> > My KEA instance has many static host reservations and some pools in some
> > subnets.
> >
> > Specifically is problematic subnet with definition:
> >
> > {
> > "id": 80,
> > "subnet": "10.8.160.128/25",
> > "option-data": [
> > { "name": "routers", "data": "10.8.160.129" },
> > ],
> > "pools": [ { "pool": "10.8.160.242 - 10.8.160.250" } ]
> > },
> >
> > There is no dynamic lease from pool, but more static reservations outside of
> > pool, but the monitoring plugins show the problem - the pool is full because:
> >
> > # echo '{ "command": "statistic-get", "arguments": { "name": "subnet[80].pool[0].assigned-addresses" } }' | socat UNIX-CONNECT:/run/kea/kea4-ctrl-socket STDIO | json_pp
> > {
> > "arguments" : {
> > "subnet[80].pool[0].assigned-addresses" : [
> > [
> > 9,
> > "2026-10-29 08:17:47.707752"
> > ],
> > [
> > 0,
> > "2026-10-29 08:17:47.707562"
> > ]
> > ]
> > },
> > "result" : 0
> > }
> >
> > Yes, I have 9 leases, but outside of pool. Is this bug in the KEA server?
> >
> > # socat /run/kea/kea4-ctrl-socket STDIO <<< '{ "command": "lease4-get-page", "arguments": { "from": "start", "limit": 100 } }' | jq -r '.arguments.leases[] | select(."subnet-id" == 80)."ip-address"'
> > 10.8.160.140
> > 10.8.160.141
> > 10.8.160.143
> > 10.8.160.145
> > 10.8.160.146
> > 10.8.160.147
> > 10.8.160.148
> > 10.8.160.150
> > 10.8.160.151
> >
> > The values in the level subnet[80] and subnet[80].pool[0] are the same.
> >
> > nssrv1.lim.i.cz:/etc/kea# echo '{ "command": "statistic-get", "arguments": { "name": "subnet[80].assigned-addresses" } }' | socat UNIX-CONNECT:/run/kea/kea4-ctrl-socket STDIO | json_pp
> > {
> > "arguments" : {
> > "subnet[80].assigned-addresses" : [
> > [
> > 9,
> > "2026-10-29 08:17:47.707724"
> > ],
> > [
> > 0,
> > "2026-10-29 08:17:47.707553"
> > ]
> > ]
> > },
> > "result" : 0
> > }
> >
> > And especially confusing is the value 0 and 9 in very close point in time.
> >
> > Server restart doesn't help:
> >
> > # systemctl restart kea-dhcp4-server.service
> > # echo '{ "command": "statistic-get", "arguments": { "name": "subnet[80].assigned-addresses" } }' | socat UNIX-CONNECT:/run/kea/kea4-ctrl-socket STDIO | json_pp
> > {
> > "arguments" : {
> > "subnet[80].assigned-addresses" : [
> > [
> > 9,
> > "2026-10-29 18:27:52.139910"
> > ],
> > [
> > 0,
> > "2026-10-29 18:27:52.139706"
> > ]
> > ]
> > },
> > "result" : 0
> > }
> >
> > I think the value is simply bad according to
> > https://kea.readthedocs.io/en/kea-3.0.3/arm/dhcp4-srv.html#dhcp4-stats
> >
> > Sorry for my English.
> > Any idea?
> > Regards
> > --
> > Zito
> > --
> > ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
> >
> > To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
> > Kea-users at lists.isc.org
> --
> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
> Kea-users at lists.isc.org
More information about the Kea-users
mailing list