Is there a parser in Perl out there for dhcpd.leases?

Russell Jackson raj at csub.edu
Fri Nov 5 19:12:14 UTC 2010


On 11/05/2010 11:12 AM, Adam Moffett wrote:
>> It would be really nice if the ISC distribution came with an executable
>> that would parse the file and produce a csv file (or some such
>> easy-to-input format file) of current leases.
> That would be good. Alternatively, having the option to store leases in
> a database instead of a file would make life simpler. If there was such
> a thing as "free time" here I would work on a patch myself.
>

Ahem. Not to be pedantic, but the leases file already is a database. 
What you mean is store it in a RDBMS. The best way to fix this would be 
to have an abstract storage API that could have dynamically loaded 
modules that hook into it so that any number of backends could be 
written without having to touch the ISC code.

What I would like to see happen is to expose all the parsers in used in 
dhcpd + libs as an easy to use API with language bindings for 
python/perl/ruby.

Not perl, but here's my python module for parsing the leases file. Attached.


-- 
Russell A Jackson <raj at csub.edu>
Network Analyst
California State University, Bakersfield
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parse.py
Type: text/x-python
Size: 3659 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20101105/f3555da4/attachment.py>


More information about the dhcp-users mailing list