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

John Wobus jw354 at cornell.edu
Fri Nov 5 16:43:31 UTC 2010


> I scan dhcpd.leases at regular intervals using a Perl script
> to extract statistics for display using MRTG.  So far, instead
> of parsing the file properly, I take advantage of its apparent
> line-oriented layout.
>
> I currently need to enhance the script, and am minded to 'fix'
> the parsing, probably using the Parse::RecDescent module from
> CPAN.
>
> If someone else has already done (some of, or something like)
> this, I'ld be happy to avoid repeating the effort.


We do the same thing.

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.  We scan and parse the
lease file frequently and our lease file is large enough that I go to
lengths to make the parsing fast, e.g. do a quick and dirty parse
after filtering the file with a grep.

John Wobus
Cornell U IT



More information about the dhcp-users mailing list