event trigger after ack

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

event trigger after ack

Leandro
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.
Regards.
Leandro.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: event trigger after ack

Steve van der Burg


Leandro <[hidden email]> 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.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: event trigger after ack

Shawn Routhier
In reply to this post by Leandro
See the “on commit” (dhcpd.conf.5) and “execute” (dhcp-eval.5) statements.
In particular see the warning in dhcp-eval.5 about the program blocking until
the execute statement finishes.

Shawn

> On Oct 1, 2015, at 8:46 AM, Leandro <[hidden email]> 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.
> Regards.
> Leandro.
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users