event trigger after ack

Steve van der Burg steve.vanderburg at lhsc.on.ca
Thu Oct 1 20:11:02 UTC 2015



Leandro <ingrogger at gmail.com> wrote:
> Hi guys.
> Im thinking about a mechanism to fill a sql table with an updated leases 
> status.
> Something like
> 
> Time                  | Client-ip            |Client MAC    |  Relay IP
> Oct  1 12:16:22 | 20.0.0.2           | d4:21:22:74:18:0a | 172.21.1.156
> 
> I achieved this using a perl tail script on the dhcp.log file matching 
> the ACK lines.
> I was wondering if is it possible to do the same using a triggered 
> script executed by the daemon after an ACK event occurs.
> 
> Anyone can point some documentation about it ?
> Is it true that this could be risky since a bad script can lead to wrong 
> function of the service ?
> 
> Any advice would be usefull.

I don't know if the trigger exists, but one way to virtually eliminate the "bad script" risk is to use the file system as a rendezvous point.  If the ACK trigger does exist, you could have it call an incredibly simple script (or possibly do it inline in the config file if the right operations are supported) to write a file with a unique (or uniqueish) name to a spot in the filesystem.  Then use incrond [http://inotify.aiken.cz/?section=incron&page=about&lang=en -- it's packaged for Debian] (which uses the inotify feature [https://en.wikipedia.org/wiki/Inotify] of the linux kernel) to launch another script that commits the file's contents to a database.

That way things are nicely uncoupled and nothing is polling (since the kernel itself notifies incrond and it launches your commit-to-database script) and in the event that the database gets busy or is unavailable, a bunch of files start to pile up somewhere and that's all.  I do this kind of thing (but not based on ISC dhcpd triggers) all the time and it works well.

...Steve


 --------------------------------------------------------------------------------
This information is directed in confidence solely to the person named above and may contain confidential and/or privileged material. This information may not otherwise be distributed, copied or disclosed. If you have received this e-mail in error, please notify the sender immediately via a return e-mail and destroy original message. Thank you for your cooperation.


More information about the dhcp-users mailing list