diff options
author | Tomek Mrugalski <tomasz@isc.org> | 2015-06-15 13:18:42 +0200 |
---|---|---|
committer | Tomek Mrugalski <tomasz@isc.org> | 2015-06-15 13:18:42 +0200 |
commit | 8d6e0a5838c9addf8e09f1e6ccd2809d35f0e62b (patch) | |
tree | 9994c92e5c78cf44e66669d03bc6949e3bb81a5a /src/lib/dhcpsrv/cfg_subnets4.cc | |
parent | [3798] Changes after review: (diff) | |
download | kea-8d6e0a5838c9addf8e09f1e6ccd2809d35f0e62b.tar.xz kea-8d6e0a5838c9addf8e09f1e6ccd2809d35f0e62b.zip |
[3798] Changes after review:
- {update,remove}Statistics moved from CfgMgr to SrvConfig,CfgSubnets4
Diffstat (limited to 'src/lib/dhcpsrv/cfg_subnets4.cc')
-rw-r--r-- | src/lib/dhcpsrv/cfg_subnets4.cc | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/lib/dhcpsrv/cfg_subnets4.cc b/src/lib/dhcpsrv/cfg_subnets4.cc index 3a27e4a6fe..5ea1a8b024 100644 --- a/src/lib/dhcpsrv/cfg_subnets4.cc +++ b/src/lib/dhcpsrv/cfg_subnets4.cc @@ -17,6 +17,7 @@ #include <dhcpsrv/cfg_subnets4.h> #include <dhcpsrv/dhcpsrv_log.h> #include <dhcpsrv/subnet_id.h> +#include <stats/stats_mgr.h> using namespace isc::asiolink; @@ -109,7 +110,7 @@ CfgSubnets4::selectSubnet(const SubnetSelector& selector) const { } // We have identified an address in the client's packet that can be - // used for subnet selection. Match this packet with the subnets. + // used for subnet selection. Match this packet with the subnets. return (selectSubnet(address, selector.client_classes_)); } @@ -145,8 +146,40 @@ CfgSubnets4::isDuplicate(const Subnet4& subnet) const { return (false); } +void +CfgSubnets4::removeStatistics() { + using namespace isc::stats; + + // For each v4 subnet currently configured, remove the statistic. + /// @todo: May move this to CfgSubnets4 class if there will be more + /// statistics here. + for (Subnet4Collection::const_iterator subnet4 = subnets_.begin(); + subnet4 != subnets_.end(); ++subnet4) { + + StatsMgr::instance().del(StatsMgr::generateName("subnet", + (*subnet4)->getID(), + "total-addresses")); + + StatsMgr::instance().del(StatsMgr::generateName("subnet", + (*subnet4)->getID(), + "assigned-addresses")); + } +} +void +CfgSubnets4::updateStatistics() { + using namespace isc::stats; + /// @todo: May move this to CfgSubnets4 class if there will be more + /// statistics here. + for (Subnet4Collection::const_iterator subnet = subnets_.begin(); + subnet != subnets_.end(); ++subnet) { + + StatsMgr::instance().setValue( + StatsMgr::generateName("subnet", (*subnet)->getID(), "total-addresses"), + static_cast<int64_t>((*subnet)->getPoolCapacity(Lease::TYPE_V4))); + } +} } // end of namespace isc::dhcp } // end of namespace isc |