[Kea-users] Can KEA trigger webhooks?

Darren Ankney darren.ankney at gmail.com
Fri Dec 23 11:38:50 UTC 2022


To be fair, what I suggested isn’t a web hook.  It is merely web based communication from the Kea server in a json format.  It’s how the HA hook communicates to perform load balancing or active standby or so on with the other server.  You can take advantage of the “passive backup” configuration to tap into the web based stream of lease data in JSON format.  Here is an example of such lifted from the manual link I sent (https://kea.readthedocs.io/en/kea-2.2.0/arm/hooks.html#passive-backup-configuration):

"Dhcp4": {
    "hooks-libraries": [{
        "library": "/usr/lib/kea/hooks/libdhcp_lease_cmds.so",
        "parameters": { }
    }, {
        "library": "/usr/lib/kea/hooks/libdhcp_ha.so",
        "parameters": {
            "high-availability": [{
                "this-server-name": "server1",
                "mode": "passive-backup",
                "wait-backup-ack": false,
                "peers": [{
                    "name": "server1",
                    "url": "http://192.168.56.33:8000/",
                    "role": "primary"
                }, {
                    "name": "server2",
                    "url": "http://192.168.56.66:8000/",
                    "role": "backup"
                }, {
                    "name": "server3",
                    "url": "http://192.168.56.99:8000/",
                    "basic-auth-user": "foo",
                    "basic-auth-password": "bar",
                    "role": "backup"
                }]
            }]
        }
    }],

JSON will be sent to http://192.168.56.66:8000 <http://192.168.56.66:8000/> and http://192.168.56.99:8000/ each time something happens (new lease, renewal, release)  So you could have some type of application listen at one of those addresses and ports and do something with the incoming JSON.  That’s pretty much all it can do, however, you can’t issue commands or anything.  The manual lays all of this out really well, so have a look there.


> On Dec 23, 2022, at 4:57 AM, Stefan G. Weichinger <lists at xunil.at> wrote:
> 
> Am 22.12.22 um 12:40 schrieb Darren Ankney:
> 
>> If you are just wanting lease information out of Kea when it
>> allocates a lease to someone, have a look at the HA hook (https://kea.readthedocs.io/en/kea-2.2.0/arm/hooks.html#ha-high-availability-outage-resilience-for-kea-servers
>> <https://kea.readthedocs.io/en/kea-2.2.0/arm/hooks.html#ha-high-availability-outage-resilience-for-kea-servers>)
>> Specifically the “passive backup” configuration
>> (https://kea.readthedocs.io/en/kea-2.2.0/arm/hooks.html#passive-backup-configuration
>> <https://kea.readthedocs.io/en/kea-2.2.0/arm/hooks.html#passive-backup-configuration>)
>> as that will send lease details in JSON to the configured IP and port
>> where you could have some type of application listening to do
>> something with the information.
> 
> I am not sure if I understand that correctly:
> 
> The called webhook IP:port would be configured as a peer under "peers:" ? Could you maybe give an example?
> 
> I am currently playing with integrating kea with n8n by using the API-Calls. This is a pull-approach, for sure a "push" would be better.
> 
> thanks!
> 
> 
> -- 
> 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 mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20221223/8850d28b/attachment.htm>


More information about the Kea-users mailing list