mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
dhcp-pool: Fix off-by-one error in pool size.
"range" statement gives the lowest and highest IP addresses (both inclusive) in a pool. dhcp-pool did not count the highest address when calculating pool size.
This commit is contained in:
parent
a582c4bae2
commit
316a59e156
@ -73,7 +73,7 @@ else {
|
||||
# For each pool, count how many leases from that pool are currently active
|
||||
foreach $start (keys %pools) {
|
||||
$size = $pools{$start};
|
||||
$end = $start+$size;
|
||||
$end = $start+$size-1;
|
||||
$free = $size;
|
||||
|
||||
foreach $lease (@activeleases) {
|
||||
@ -103,9 +103,12 @@ sub determine_pools {
|
||||
if ($line =~ /range[\s]+([\d]+\.[\d]+\.[\d]+\.[\d]+)[\s]+([\d]+\.[\d]+\.[\d]+\.[\d]+)/) {
|
||||
$start = string2ip($1);
|
||||
$end = string2ip($2);
|
||||
$size = $end - $start;
|
||||
|
||||
defined($start) || next;
|
||||
defined($end) || next;
|
||||
|
||||
# The range statement gives the lowest and highest IP addresses in a range.
|
||||
$size = $end - $start + 1;
|
||||
|
||||
$pools{$start} = $size;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user