We use phpIPAM to manage all our IP Addresses, and we have recently built integrations between phpIPAM and our Kea DHCP server for reservations, and also into our BIND DNS server.
These have been running on a schedule, which has worked well, but doing it that way means that it can take a while after a change inside phpIPAM for that change to be reflected in DNS/DHCP.
What I have made is a simple tool that watches the phpIPAM logs, and when it sees a change it will trigger the integrations to run immediately, avoiding all the waiting. This is written in the nim programing language. I’ve uploaded the code as a snippet to gitlab here:
https://gitlab.com/-/snippets/2075063
To make this work I also needed to configure phpIPAM to log changes to syslog as well as to the database:

The way the tool works is it runs the journalctl --follow
command and then looks in the output for ipamprd1.example.org phpipam-changelog
(obviously you need to replace with your hostname)
If it sees a line that matches it kicks off all the integrations, using either systemctl start integration.service
or using ssh to connect to another server where the integration runs.
2 replies on “A Logwatcher Tool to Trigger Integrations After Changes in phpIPAM”
Hey there, how are you doing? Awesome content in your site.
I was wondering, what sources did you use to manage to integrate kea Dhcp and phpipam, I want to try to integrate ours. Thanks in advance.
Hi John,
I’ve made a gitlab snippet here with some of our tooling – hopefully this will get you started.
Basically it will run on a schedule (or triggered by the logwatcher) and will regenerate all the Kea reservation files as needed.
https://gitlab.com/-/snippets/2308188
Regards, Jay