KEA: Adding libdhcp_stat_cmds.so as hook library
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Open mvc/app/models/OPNsense/Kea/KeaDhcpv4.php and review the existing hooks-libraries list. Add the libdhcp_stat_cmds.so entry as shown in the issue, then check the generated Kea DHCPv4 configuration to confirm the hook library is included.
Written by the indexing model from the issue text.
Description
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
- I have read the contributing guidelines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md
- I am convinced that my issue is new after having checked both open and closed issues at https://github.com/opnsense/core/issues?q=is%3Aissue
- AI tools were used to create at least part of the text submitted herewith.
If AI was used, please disclose:
- Model used: https://www.deepl.com/de/translator
- Extent of AI involvement: just to improve the English translation
Is your feature request related to a problem? Please describe.
We use to quite an extend Zabbix for monitoring several OPNsense systems. The user facing networks utilize KEA to provide DHCP services. Sometimes it is not clear how many devices to expect and hence we observe the DHCP pool capacity closely.
For this we have implemented a Zabbix UserParameter that is is calling the KEA control agent on Port 8004 and requesting
UserParameter=opnsense.kea.dhcp4.pools,/usr/local/bin/curl -s -X POST http://localhost:8004 -H "Content-Type: application/json" -d '{"command": "stat-lease4-get", "service": ["dhcp4"], "arguments": {}}'
BTW Captive Portal and Control Agent share the same default port...
The REST-Command stat-lease4-get is based on the hook library stat_cmds. Hence, we patch the file /usr/local/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php after every update to contain ['library' => '/usr/local/lib/kea/hooks/libdhcp_stat_cmds.so'].
Describe the solution you like
It should be enough to simply add the hook library to [‘library’ => ‘/usr/local/lib/kea/hooks/libdhcp_stat_cmds.so’] in /usr/local/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php.
...
'hooks-libraries' => [
/*
* Hook loading order can be important in some cases:
* https://kea.readthedocs.io/en/latest/arm/hooks.html#binding-variables
*/
[
'library' => '/usr/local/lib/kea/hooks/libdhcp_ping_check.so',
'parameters' => [
'enable-ping-check' => false,
],
],
['library' => '/usr/local/lib/kea/hooks/libdhcp_lease_cmds.so'],
['library' => '/usr/local/lib/kea/hooks/libdhcp_host_cmds.so'],
['library' => '/usr/local/lib/kea/hooks/libdhcp_stat_cmds.so'],
],
...
Describe alternatives you considered
It would be possible to count and calculate the leases from the file /var/db/kea/kea-leases4.csv. However, that seems more like a workaround.
- Dominant language
- PHP
- Stars
- 4.8k
- Forks
- 1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 36
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from opnsense/core
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
opnsense/core#11171 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
opnsense/core#11148 · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Old /download.php attachment links: redirect drops the subfolder, nginx.example.conf returns 404OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
enhancement Feature: Users good first issue UI
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
vimeo/psalm#13772 · 2 comments ·
Maintainers usually reply within 4 days