I use dnsmasq as part of the DNSSEC Appliance at Casa Mens, and I had it use a Lua script to notify me when a new DHCP lease is issued. (You may recall that Simon Kelly integrated Lua into dnsmasq two years ago.) That’s all fine and dandy, but I often need to check back which lease was issued. I can do that by logging onto DAP to find the leases file, but that’s cumbersome.
If you’ve been following a bit of what I do, you’ll know that I’m very interested in all things MQTT. It occurred to me it would be trivial to have dnsmasq invoke a script which publishes a lease change to a particular topic; setting the retain flag on the message will allow me to quickly check back – I’ll get all messages published to topics I subscribe to:
I configure dnsmasq to launch a shell script on lease change in
The script itself is trivial:
One thing to note is the
-r switch which sets the retain flag which causes a correctly configured broker to retain (i.e. store) the last message on a per/topic basis persistently.
If I then use my own mqtt-osx-notifier I’ll be notified as leases are issued.