[stork-users] No leases showing on Stork

Slawek Figiel slawek at isc.org
Fri Nov 8 14:24:42 UTC 2024


Hello Roberto!

Have you loaded the `stat_cmds` hook in Kea? It is necessary to gather 
the statistics. For example:

```
     "hooks-libraries": [
         {
             "library": "/usr/lib/kea/libdhcp_stat_cmds.so"
         }
     ]
```

Regards,
Slawek Figiel

On 08/11/2024 15:20, Roberto Greiner wrote:
> Indeed, when I fill a complete name in the search field, it does show 
> the lease. The problem is that in the "Dashboard" all subnets show "0% 
> used" and "Addresses 0 / 0 (0% used)", despite that there are active 
> leases and that the search page does return answers when I fill the name 
> of a machine.
> 
> Did I miss something else?
> 
> Thank you,
> 
> Roberto
> 
> Em 08/11/2024 11:04, Marcin Siodelski escreveu:
>> Stork has limited capabilities with respect to searching leases. In 
>> particular, it doesn't currently support searching the leases by 
>> partial IP address, hostname or any other identifier. Suppose I have a 
>> lease with a hostname of "client-1.example.org". You have to specify 
>> this exact string in the search box to find this lease. If you, say, 
>> type "client-1.example.or" the lease won't be found. The same is the 
>> case for any other identifier, e.g. MAC address, client identifier, 
>> delegated prefix, IP address etc.
>>
>> Do you think this might be the case for you?
>>
>> Marcin
>>
>>
>> On 8.11.2024 14:51, Roberto Greiner wrote:
>>> Ok, I'm still missing something.
>>>
>>> I've added the following to both dhcp4.conf and dhcp6.conf:
>>>
>>>    "hooks-libraries": [
>>>         {
>>>             "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/ 
>>> libdhcp_lease_cmds.so"
>>>         }
>>>         ],
>>>
>>> I restarted all isc- daemons(dhcpv4, dhcpv6, stork-server and stork- 
>>> agent). In the logs, both dhcpv4 and dhcpv6 registered the hook:
>>> 2024-11-08T10:16:48.614601-03:00 dnsprimario kea-dhcp6[38047]: INFO 
>>> HOOKS_LIBRARY_LOADED hooks library /usr/lib/x86_64-linux-gnu/kea/ 
>>> hooks/libdhcp_lease_cmds.so successfully loaded
>>>
>>> In the web page, Stork shows the the hook was recognized for both 
>>> daemons. Also, in the logs something seems to be happening with lines 
>>> like:
>>> 2024-11-08T10:19:33.592446-03:00 dnsprimario kea-ctrl-agent[7847]: 
>>> INFO  COMMAND_RECEIVED Received command 'lease4-get-by-hostname'
>>> 2024-11-08T10:19:33.592603-03:00 dnsprimario kea-ctrl-agent[7847]: 
>>> INFO  CTRL_AGENT_COMMAND_RECEIVED command lease4-get-by-hostname 
>>> received from remote address 127.0.0.1
>>> 2024-11-08T10:19:33.593008-03:00 dnsprimario kea-dhcp4[38034]: INFO 
>>> COMMAND_RECEIVED Received command 'lease4-get-by-hostname'
>>> 2024-11-08T10:19:33.593141-03:00 dnsprimario kea-ctrl-agent[7847]: 
>>> INFO  CTRL_AGENT_COMMAND_FORWARDED command lease4-get-by-hostname 
>>> successfully forwarded to the service dhcp4 from remote address 
>>> 127.0.0.1
>>> 2024-11-08T10:19:33.593687-03:00 dnsprimario kea-ctrl-agent[7847]: 
>>> INFO  COMMAND_RECEIVED Received command 'lease6-get-by-hostname'
>>> 2024-11-08T10:19:33.593795-03:00 dnsprimario kea-ctrl-agent[7847]: 
>>> INFO  CTRL_AGENT_COMMAND_RECEIVED command lease6-get-by-hostname 
>>> received from remote address 127.0.0.1
>>> 2024-11-08T10:19:33.594326-03:00 dnsprimario kea-dhcp6[38047]: INFO 
>>> COMMAND_RECEIVED Received command 'lease6-get-by-hostname'
>>> 2024-11-08T10:19:33.594439-03:00 dnsprimario kea-ctrl-agent[7847]: 
>>> INFO  CTRL_AGENT_COMMAND_FORWARDED command lease6-get-by-hostname 
>>> successfully forwarded to the service dhcp6 from remote address 
>>> 127.0.0.1
>>>
>>> Buuuuuuut, the leases are still not showing. So, obviously, I'm still 
>>> missing something. :-P
>>>
>>> Any idea of what that would be?
>>>
>>> Thank you,
>>>
>>> Roberto
>>>
>>>
>>> Em 08/11/2024 10:08, Marcin Siodelski escreveu:
>>>> Roberto,
>>>>
>>>> Thank you for using Stork software.
>>>>
>>>> In order for Stork to gather leases from the Kea instances you need 
>>>> to load "libdhcp_lease_cmds" hook library in Kea. See: https:// 
>>>> stork.readthedocs.io/en/v1.19.0/usage.html#leases-search
>>>>
>>>> Marcin Siodelski
>>>> ISC
>>>>
>>>> On 8.11.2024 13:48, Roberto Greiner wrote:
>>>>> Hi,
>>>>>
>>>>> I've installed Kea and Stork in my network and have almost 
>>>>> everything working, except that Stork is not showing the leases 
>>>>> that are allocated by kea. Stork does show all the networks I've 
>>>>> set and in the "Machines" pages shows that the dhcpv4, dhcpv6, ddns 
>>>>> and ca daemons are working and communicating. The "kea Apps" page 
>>>>> shows that one server and also indicates all status ok. The 
>>>>> dashboard page shows all networks, but says all leases are in zero.
>>>>>
>>>>> Can somebody help me on this?
>>>>>
>>>>> Thank you,
>>>>>
>>>>> Roberto
>>>>>
>>>>> My setup:
>>>>> Both kea and and stork are installed using packages from the isc 
>>>>> servers.
>>>>> Kea version 2.6.1
>>>>> Stork version 1.19
>>>>> Server is a 24.04.1 Ubuntu VM with 4GB RAM and 12 GB disk in a Xen 
>>>>> Citrix environment
>>>>> I have one IPv4 network and 3 IPv6 network configured, but only in 
>>>>> one of each is the server allocating IPs
>>>>> leases files are in /var/lib/kea/ and are being populated properly 
>>>>> (kea-leases4.csv and kea-leases6.csv)
>>>>>
>>>>> I've tried using MySQL for the leases, but the result was the same. 
>>>>> In both cases, Stork shows correctly where the leases are stored, 
>>>>> but does not fetch those leases.
>>>>> My configs (with password and actual networks replaced):
>>>>>
>>>>> kea-dhcp4.conf:
>>>>> {
>>>>> "Dhcp4": {
>>>>>     "interfaces-config": {
>>>>>         "interfaces": [ "enX2" ]
>>>>>     },
>>>>>     "control-socket": {
>>>>>         "socket-type": "unix",
>>>>>         "socket-name": "/tmp/kea4-ctrl-socket"
>>>>>     },
>>>>>     "lease-database": {
>>>>>         "type": "memfile",
>>>>>         "persist": true,
>>>>>         "lfc-interval": 3600,
>>>>>         "name": "/var/lib/kea/kea-leases4.csv"
>>>>>     },
>>>>>     "expired-leases-processing": {
>>>>>         "reclaim-timer-wait-time": 10,
>>>>>         "flush-reclaimed-timer-wait-time": 25,
>>>>>         "hold-reclaimed-time": 3600,
>>>>>         "max-reclaim-leases": 100,
>>>>>         "max-reclaim-time": 250,
>>>>>         "unwarned-reclaim-cycles": 5
>>>>>     },
>>>>>     "renew-timer": 900,
>>>>>     "rebind-timer": 1800,
>>>>>     "valid-lifetime": 3600,
>>>>>     "option-data": [
>>>>>         {
>>>>>             "name": "domain-name-servers",
>>>>>             "data": "10.0.0.1, 8.8.8.8"
>>>>>         },
>>>>>         {
>>>>>             "code": 15,
>>>>>             "data": "domain.org.br"
>>>>>         },
>>>>>         {
>>>>>             "name": "domain-search",
>>>>>             "data": "domain.org.br"
>>>>>         },
>>>>>         {
>>>>>             "name": "boot-file-name",
>>>>>             "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
>>>>>         },
>>>>>         {
>>>>>             "name": "default-ip-ttl",
>>>>>             "data": "0xf0"
>>>>>         }
>>>>>     ],
>>>>>     "subnet4": [
>>>>>         {
>>>>>             "id": 1,
>>>>>             "subnet": "10.0.0.192/26",
>>>>>             "pools": [ { "pool": "10.0.0.193 - 10.0.0.251" } ],
>>>>>             "option-data": [
>>>>>                 {
>>>>>                     "name": "routers",
>>>>>                     "data": "10.0.0.254"
>>>>>                 }
>>>>>             ],
>>>>>         }
>>>>>     ],
>>>>>     "loggers": [
>>>>>     {
>>>>>         "name": "kea-dhcp4",
>>>>>         "output-options": [
>>>>>             {
>>>>>                 "output": "stdout",
>>>>>                 "pattern": "%-5p %m\n",
>>>>>             }
>>>>>         ],
>>>>>         "severity": "INFO",
>>>>>         "debuglevel": 0
>>>>>     }
>>>>>   ]
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> kea-dhcp6.conf
>>>>> {
>>>>> "Dhcp6": {
>>>>>     "valid-lifetime": 4000,
>>>>>     "renew-timer": 1000,
>>>>>     "rebind-timer": 2000,
>>>>>     "preferred-lifetime": 3000,
>>>>>     "interfaces-config": {
>>>>>         "interfaces": [ "enX2/fc00::9" ]
>>>>>     },
>>>>>     "control-socket": {
>>>>>         "socket-type": "unix",
>>>>>         "socket-name": "/tmp/kea6-ctrl-socket"
>>>>>     },
>>>>>     "lease-database": {
>>>>>         "type": "memfile",
>>>>>         "persist": true,
>>>>>         "name": "/var/lib/kea/kea-leases6.csv"
>>>>>     },
>>>>>     "subnet6": [
>>>>>         {
>>>>>             "id": 1,
>>>>>             "subnet": "fc00:20::/64"
>>>>>         },
>>>>>         {
>>>>>             "interface": "enX2",
>>>>>             "id": 2,
>>>>>             "subnet": "fc00::/64",
>>>>>             "pools": [
>>>>>                 {
>>>>>                     "pool": "fc00::10:1-fc00::a2:ffff:ffff:ffff"
>>>>>                 }
>>>>>              ],
>>>>>             "option-data": [
>>>>>                 {
>>>>>                     "name": "domain-search",
>>>>>                     "code": 24,
>>>>>                     "data": "fdn.domain.org.br"
>>>>>                },
>>>>>                 {
>>>>>                     "name": "dns-servers",
>>>>>                     "data": "fc00::1, 2001:4860:4860::8888"
>>>>>                 }
>>>>>              ],
>>>>>         },
>>>>>         {
>>>>>             "id": 3,
>>>>>             "interface": "enX0",
>>>>>             "subnet": "fc00:10::/64"
>>>>>         }
>>>>>     ],
>>>>>     "loggers": [
>>>>>     {
>>>>>         "name": "kea-dhcp6",
>>>>>         "output-options": [
>>>>>             {
>>>>>                 "output": "stdout",
>>>>>                 "pattern": "%-5p %m\n",
>>>>>             }
>>>>>         ],
>>>>>         "severity": "INFO",
>>>>>     }
>>>>>   ]
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>>  kea-ctrl-agent.conf
>>>>> {
>>>>> "Control-agent": {
>>>>>     "http-host": "127.0.0.1",
>>>>>     "http-port": 8000,
>>>>>     "control-sockets": {
>>>>>         "dhcp4": {
>>>>>             "socket-type": "unix",
>>>>>             "socket-name": "/tmp/kea4-ctrl-socket"
>>>>>         },
>>>>>         "dhcp6": {
>>>>>             "socket-type": "unix",
>>>>>             "socket-name": "/tmp/kea6-ctrl-socket"
>>>>>         },
>>>>>         "d2": {
>>>>>             "socket-type": "unix",
>>>>>             "socket-name": "/tmp/kea-ddns-ctrl-socket"
>>>>>         }
>>>>>     },
>>>>>     "hooks-libraries": [
>>>>>     ],
>>>>>     "loggers": [
>>>>>     {
>>>>>         "name": "kea-ctrl-agent",
>>>>>         "output-options": [
>>>>>             {
>>>>>                 "output": "stdout",
>>>>>                 "pattern": "%-5p %m\n"
>>>>>             }
>>>>>         ],
>>>>>         "severity": "info",
>>>>>         "debuglevel": 0
>>>>>     }
>>>>>   ]
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> server.env:
>>>>> STORK_DATABASE_NAME=stork
>>>>> STORK_DATABASE_USER_NAME=stork-server
>>>>> STORK_DATABASE_PASSWORD=<some pass>
>>>>> STORK_REST_STATIC_FILES_DIR=/usr/share/stork/www
>>>>>
>>>>> agent.env
>>>>> STORK_AGENT_PORT=8079
>>>>>
>>>>
>>



More information about the Stork-users mailing list