logging the starts and end lease time in an "on commit" blocks

Sébastien CRAMATTE s.cramatte at wanadoo.fr
Sun Aug 10 22:58:34 UTC 2008


Hello,


How can I log the starts and end lease time in an "on commit" block ?
I don't want the duration of the lease ...

Currently I use this block

on commit { 

    set leasetime  = encode-int(lease-time, 32);
    set client = binary-to-ascii (10,8,".", leased-address);
    set cpe = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
    set modem = binary-to-ascii(16, 8, ":", option agent.remote-id);
   
    log(info, concat("commit:", client, ";cpe:", cpe,";modem:", modem, 
binary-to-ascii(10, 32, "", leasetime)));
}


NOTE : leasetime return me 86400 what is the correct value. Now I jut 
need when start the lease.

I need to insert these data to Mysql. I can use time from this script  
but value will never be the exact as in dhcpd.leases file ...

Regards



More information about the dhcp-users mailing list