mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-11-25 19:47:02 +00:00
Merge pull request #752 from avian2/fix-dhcp-pool
dhcp-pool: fix conffile parsing
This commit is contained in:
commit
521bc92393
1 changed files with 7 additions and 2 deletions
|
|
@ -73,7 +73,7 @@ else {
|
||||||
# For each pool, count how many leases from that pool are currently active
|
# For each pool, count how many leases from that pool are currently active
|
||||||
foreach $start (keys %pools) {
|
foreach $start (keys %pools) {
|
||||||
$size = $pools{$start};
|
$size = $pools{$start};
|
||||||
$end = $start+$size;
|
$end = $start+$size-1;
|
||||||
$free = $size;
|
$free = $size;
|
||||||
|
|
||||||
foreach $lease (@activeleases) {
|
foreach $lease (@activeleases) {
|
||||||
|
|
@ -98,12 +98,17 @@ sub determine_pools {
|
||||||
close (CONFFILE);
|
close (CONFFILE);
|
||||||
|
|
||||||
foreach $line (@conffile) {
|
foreach $line (@conffile) {
|
||||||
|
next if $line =~ /^\s*#/;
|
||||||
|
|
||||||
if ($line =~ /range[\s]+([\d]+\.[\d]+\.[\d]+\.[\d]+)[\s]+([\d]+\.[\d]+\.[\d]+\.[\d]+)/) {
|
if ($line =~ /range[\s]+([\d]+\.[\d]+\.[\d]+\.[\d]+)[\s]+([\d]+\.[\d]+\.[\d]+\.[\d]+)/) {
|
||||||
$start = string2ip($1);
|
$start = string2ip($1);
|
||||||
$end = string2ip($2);
|
$end = string2ip($2);
|
||||||
$size = $end - $start;
|
|
||||||
defined($start) || next;
|
defined($start) || next;
|
||||||
defined($end) || next;
|
defined($end) || next;
|
||||||
|
|
||||||
|
# The range statement gives the lowest and highest IP addresses in a range.
|
||||||
|
$size = $end - $start + 1;
|
||||||
|
|
||||||
$pools{$start} = $size;
|
$pools{$start} = $size;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue