From 2fd01d998d0e2e1509327aa5989c41d764bbc34c Mon Sep 17 00:00:00 2001 From: "Kim B. Heino" Date: Thu, 1 Apr 2021 16:41:30 +0300 Subject: [PATCH] dhcp-pool: count only active leases, not free ones Lease can be within time limits, but freed. Don't count them. --- plugins/dhcp/dhcp-pool | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/dhcp/dhcp-pool b/plugins/dhcp/dhcp-pool index a58a019e..9dde7c77 100755 --- a/plugins/dhcp/dhcp-pool +++ b/plugins/dhcp/dhcp-pool @@ -160,6 +160,8 @@ sub determine_active_leases { } elsif ($line =~ /ends \d ([\d]{4})\/([\d]{2})\/([\d]{2}) ([\d]{2}):([\d]{2}):([\d]{2})/) { $enddate = mktime($6, $5, $4, $3, $2-1, $1-1900, 0, 0); + } + elsif ($line =~ /binding state active/) { if (defined($enddate) && defined($startdate) && defined($lease)) { if ($startdate < time() && $enddate > time()) { push (@activeleases, $lease);