parsing dhcpd.leases file

Daniel Duarte dan.r.duarte at gmail.com
Wed Apr 15 18:12:28 UTC 2009


2009/4/15 Steve van der Burg <steve.vanderburg at lhsc.on.ca>:
>
> Doesn't dhcpd.leases contain, right from the point of its creation, all the useful things that were in dhcpd.leases~?
>
> I avoid all that complexity and simply parse the whole file, all 30 megabytes or do (about 12k active leases at the moment) once every 2 minutes on each one of my 3.0.x partner pair servers.  On modern hardware (dual-core AMD Opteron 2200 Sun X4100s running Solaris 10) the parse takes less than 10 seconds to run and introduces no noticeable load on the server.  My code (below) spits out a frozen perl data structure which I then ship off to a central server.
>

Hi,

Thanks for the reply. The problem with just parsing the active lease
file periodically is that when the file rotates, I will lose some
transactions, and I would like to avoid it if possible. For example:

- file parsed at 00h00
- client renews at 00h05 and 00h15;
- file rotates at 00h20;
- file parsed at 00h30;

On this scenario, we would lose the renew of 00h05.When the file
rotates it only saves on file the last lease information, not the
previous ones.

Obviously there's a balance here between code complexity, and need to
save all data. We can minimize the risk by parsing the file more
frequently...

Thanks,
Daniel



More information about the dhcp-users mailing list