Kea 1.5.0
stat_cmds.cc
Go to the documentation of this file.
1// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
9#include <config/cmds_impl.h>
11#include <cc/data.h>
12#include <dhcpsrv/cfgmgr.h>
13#include <dhcpsrv/lease_mgr.h>
15#include <dhcpsrv/subnet_id.h>
16#include <hooks/hooks.h>
18#include <stat_cmds.h>
19#include <stat_cmds_log.h>
20#include <stats/stats_mgr.h>
22
23#include <boost/date_time/posix_time/posix_time.hpp>
24#include <string>
25
26using namespace isc::dhcp;
27using namespace isc::data;
28using namespace isc::config;
29using namespace isc::asiolink;
30using namespace isc::hooks;
31using namespace isc::stats;
32using namespace std;
33
34namespace isc {
35namespace stat_cmds {
36
40class NotFound: public isc::Exception {
41public:
42 NotFound (const char* file, size_t line, const char* what) :
43 isc::Exception(file, line, what) { };
44};
45
47class LeaseStatCmdsImpl : private CmdsImpl {
48public:
49
51 class Parameters {
52 public:
56
59
63
65 std::string toText() {
66 std::stringstream os;
67 switch (select_mode_) {
69 os << "[all subnets]";
70 break;
72 os << "[subnet-id=" << first_subnet_id_ << "]";
73 break;
75 os << "[subnets " << first_subnet_id_
76 << " through " << last_subnet_id_ << "]";
77 break;
78 }
79
80 return (os.str());
81 }
82 };
83
84public:
85
97 int
99
111 int
113
123 Parameters getParameters(const ConstElementPtr& cmd_args);
124
142 uint64_t makeResultSet4(const ElementPtr& result, const Parameters& params);
143
160 uint64_t makeResultSet6(const ElementPtr& result, const Parameters& params);
161
182 const std::vector<std::string>& column_labels);
183
191 void addValueRow4(ElementPtr value_rows, const SubnetID &subnet_id,
192 int64_t assigned, int64_t declined);
193
202 void addValueRow6(ElementPtr value_rows, const SubnetID &subnet_id,
203 int64_t assigned, int64_t declined, int64_t assigned_pds);
204
211 int64_t getSubnetStat(const SubnetID& subnet_id, const std::string& name);
212};
213
214int
217 Parameters params;
218 ConstElementPtr response;
219
220 // Extract the command and then the parameters
221 try {
222 extractCommand(handle);
223 params = getParameters(cmd_args_);
224 } catch (const std::exception& ex) {
225 LOG_ERROR(stat_cmds_logger, STAT_CMDS_LEASE4_GET_INVALID)
226 .arg(ex.what());
227 setErrorResponse(handle, ex.what());
228 return (1);
229 }
230
231 try {
232 // Now build the result set
233 uint64_t rows = makeResultSet4(result, params);
234 LOG_INFO(stat_cmds_logger, STAT_CMDS_LEASE4_GET)
235 .arg(params.toText())
236 .arg(rows);
237 std::stringstream os;
238 os << "stat-lease4-get" << params.toText() << ": " << rows << " rows found";
239 response = createAnswer(CONTROL_RESULT_SUCCESS, os.str(), result);
240 } catch (const NotFound& ex) {
241 // Criteria was valid but included no known subnets,
242 // so we return a not found response.
243 LOG_INFO(stat_cmds_logger, STAT_CMDS_LEASE4_GET_NO_SUBNETS)
244 .arg(params.toText())
245 .arg(ex.what());
246 std::stringstream os;
247 os << "stat-lease4-get" << params.toText() << ": no matching data, " << ex.what();
248 response = createAnswer(CONTROL_RESULT_EMPTY, os.str(), result);
249 } catch (const std::exception& ex) {
250 LOG_ERROR(stat_cmds_logger, STAT_CMDS_LEASE4_GET_FAILED)
251 .arg(params.toText())
252 .arg(ex.what());
253 setErrorResponse(handle, ex.what());
254 return (1);
255 }
256
257 setResponse(handle, response);
258 return (0);
259}
260
261int
264 Parameters params;
265 ConstElementPtr response;
266
267 // Extract the command and then the parameters
268 try {
269 extractCommand(handle);
270 params = getParameters(cmd_args_);
271 } catch (const std::exception& ex) {
272 LOG_ERROR(stat_cmds_logger, STAT_CMDS_LEASE6_GET_INVALID)
273 .arg(ex.what());
274 setErrorResponse(handle, ex.what());
275 return (1);
276 }
277
278 try {
279 // Now build the result set
280 uint64_t rows = makeResultSet6(result, params);
281 LOG_INFO(stat_cmds_logger, STAT_CMDS_LEASE6_GET)
282 .arg(params.toText())
283 .arg(rows);
284 std::stringstream os;
285 os << "stat-lease6-get" << params.toText() << ": " << rows << " rows found";
286 response = createAnswer(CONTROL_RESULT_SUCCESS, os.str(), result);
287 } catch (const NotFound& ex) {
288 // Criteria was valid but included no known subnets,
289 // so we return a not found response.
290 LOG_INFO(stat_cmds_logger, STAT_CMDS_LEASE6_GET_NO_SUBNETS)
291 .arg(params.toText())
292 .arg(ex.what());
293 std::stringstream os;
294 os << "stat-lease6-get" << params.toText() << ": no matching data, " << ex.what();
295 response = createAnswer(CONTROL_RESULT_EMPTY, os.str(), result);
296 } catch (const std::exception& ex) {
297 LOG_ERROR(stat_cmds_logger, STAT_CMDS_LEASE6_GET_FAILED)
298 .arg(params.toText())
299 .arg(ex.what());
300 setErrorResponse(handle, ex.what());
301 return (1);
302 }
303
304 setResponse(handle, response);
305 return (0);
306}
307
310 Parameters params;
311
313 params.first_subnet_id_ = 0;
314 params.last_subnet_id_ = 0;
315 if (!cmd_args ) {
316 // No arguments defaults to ALL_SUBNETS.
317 return (params);
318 }
319
320 if (cmd_args->getType() != Element::map) {
321 isc_throw(BadValue, "'arguments' parameter is not a map");
322 }
323
325 if (cmd_args->contains("subnet-id")) {
326
327 ConstElementPtr value = cmd_args->get("subnet-id");
328 if (value->getType() != Element::integer) {
329 isc_throw(BadValue, "'subnet-id' parameter is not integer");
330 }
331
332 if (value->intValue() <= 0) {
333 isc_throw(BadValue, "'subnet-id' parameter must be > 0");
334 }
335
336 params.first_subnet_id_ = value->intValue();
338 }
339
340 if (cmd_args->contains("subnet-range")) {
342 isc_throw(BadValue, "cannot specify both subnet-id and subnet-range");
343 }
344
345 ConstElementPtr range = cmd_args->get("subnet-range");
346 if (range->getType() != Element::map) {
347 isc_throw(BadValue, "subnet-range parameter is not a map");
348 }
349
350 ConstElementPtr value = range->get("first-subnet-id");
351 if (!value || value->getType() != Element::integer) {
352 isc_throw(BadValue, "'first-subnet-id' parameter missing or not an integer");
353 }
354
355 if (value->intValue() <= 0) {
356 isc_throw(BadValue, "'first-subnet-id' parameter must be > 0");
357 }
358
359 params.first_subnet_id_ = value->intValue();
360
361 value = range->get("last-subnet-id");
362 if (!value || value->getType() != Element::integer) {
363 isc_throw(BadValue, "'last-subnet-id' parameter missing or not an integer");
364 }
365
366 if (value->intValue() <= 0) {
367 isc_throw(BadValue, "'last-subnet-id' parameter must be > 0");
368 }
369
370 params.last_subnet_id_ = value->intValue();
371
372 if (params.last_subnet_id_ < params.first_subnet_id_) {
373 isc_throw(BadValue, "'last-subnet-id' must be greater than 'first-subnet-id'");
374 }
375
377 }
378
379 return (params);
380}
381
382uint64_t
384 const Parameters& params) {
385 // First we need to determine the range of configured subnets
386 // which meet the selection criteria. If the range contains
387 // no subnets we punt.
388 const Subnet4Collection* subnets =
389 CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll();
390 const auto& idx = subnets->get<SubnetSubnetIdIndexTag>();
391
392 // Init to ALL so we can use auto ;)
393 auto lower = idx.begin();
394 auto upper = idx.end();
395 switch (params.select_mode_) {
397 lower = idx.find(params.first_subnet_id_);
398 // If it's an unknown subnet, punt.
399 if (lower == idx.end()) {
400 isc_throw(NotFound, "subnet-id: "
401 << params.first_subnet_id_ << " does not exist");
402 }
403
404 upper = idx.upper_bound(params.first_subnet_id_);
405 break;
407 lower = idx.lower_bound(params.first_subnet_id_);
408 upper = idx.upper_bound(params.last_subnet_id_);
409 break;
410 default:
411 break;
412 }
413
414 // If it's an empty range, punt.
415 if (lower == upper) {
416 isc_throw(NotFound, "selected ID range: "
417 << params.first_subnet_id_ << " through "
418 << params.last_subnet_id_ << " includes no known subnets");
419 }
420
421 // Now, that we have a valid range, run the Lease query.
422 LeaseStatsQueryPtr query;
423 switch (params.select_mode_) {
426 break;
430 break;
434 params.last_subnet_id_);
435 break;
436 }
437
438 // Create the empty result-set.
439 std::vector<std::string>column_labels = { "subnet-id", "total-addreses",
440 "assigned-addreses","declined-addreses"};
441 ElementPtr value_rows = createResultSet(result_wrapper, column_labels);
442
443 // Get the first query row
444 LeaseStatsRow query_row;
445 bool query_eof = !(query->getNextRow(query_row));
446
447 // Now we iterate over the selected range, building rows accordingly.
448 for (auto cur_subnet = lower; cur_subnet != upper; ++cur_subnet) {
449 SubnetID cur_id = (*cur_subnet)->getID();
450
451 // Add total only rows for subnets that occur before,
452 // in-between, or after the subnets in the query content
453 if ((cur_id < query_row.subnet_id_) ||
454 (cur_id > query_row.subnet_id_) ||
455 (query_eof)) {
456 // Generate a totals only row
457 addValueRow4(value_rows, cur_id, 0, 0);
458 continue;
459 }
460
461 // Current subnet matches query row, so iterate over its
462 // query rows (one per state) and accumulate them
463 // into a result-set row.
464 int64_t assigned = 0;
465 int64_t declined = 0;
466 bool add_row = false;
467 while (!query_eof && (query_row.subnet_id_ == cur_id)) {
468 if (query_row.lease_state_ == Lease::STATE_DEFAULT) {
469 add_row = true;
470 assigned = query_row.state_count_;
471 } else if (query_row.lease_state_ == Lease::STATE_DECLINED) {
472 add_row = true;
473 declined = query_row.state_count_;
474 }
475
476 query_eof = !(query->getNextRow(query_row));
477 }
478
479 // Add the row for the current subnet
480 if (add_row) {
481 addValueRow4(value_rows, cur_id, assigned, declined);
482 }
483 }
484
485 return (value_rows->size());
486}
487
488uint64_t
490 const Parameters& params) {
491 // Iterate over the selected range of configured subnets generating
492 // a result-set row for each one. If a subnet has data in the query
493 // content use it, otherwise, it gets a row with totals only. This
494 // way we send back a row for every selected subnet.
495 const Subnet6Collection* subnets =
496 CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll();
497
498 // Set the bounds on the selected subnet range
499 const auto& idx = subnets->get<SubnetSubnetIdIndexTag>();
500
501 // Init to all so we can use auto ;)
502 auto lower = idx.begin();
503 auto upper = idx.end();
504 switch (params.select_mode_) {
506 lower = idx.lower_bound(params.first_subnet_id_);
507 // If it's an unknown subnet, punt.
508 if (lower == idx.end()) {
509 isc_throw(NotFound, "subnet-id: "
510 << params.first_subnet_id_ << " does not exist");
511 }
512
513 upper = idx.upper_bound(params.first_subnet_id_);
514 break;
516 lower = idx.lower_bound(params.first_subnet_id_);
517 upper = idx.upper_bound(params.last_subnet_id_);
518 break;
519 default:
520 break;
521 }
522
523 // If it's empty range, punt.
524 if (lower == upper) {
525 isc_throw(NotFound, "selected ID range: "
526 << params.first_subnet_id_ << " through "
527 << params.last_subnet_id_ << " includes no known subnets");
528 }
529
530 // Create the result-set map.
531 // labels could be class statics?
532 std::vector<std::string>column_labels = { "subnet-id", "total-nas", "assigned-nas",
533 "declined-nas", "total-pds", "assigned-pds"};
534 ElementPtr value_rows = createResultSet(result_wrapper, column_labels);
535
536 // Now we can run the stats query.
537 LeaseStatsQueryPtr query;
538 switch (params.select_mode_) {
541 break;
545 break;
549 params.last_subnet_id_);
550 break;
551 }
552
553 // Get the first query row
554 LeaseStatsRow query_row;
555 bool query_eof = !(query->getNextRow(query_row));
556
557 for (auto cur_subnet = lower; cur_subnet != upper; ++cur_subnet) {
558 SubnetID cur_id = (*cur_subnet)->getID();
559
560 // Add total only rows for subnets that occur before,
561 // in-between, or after subnets in the query content
562 if ((cur_id < query_row.subnet_id_) ||
563 (cur_id > query_row.subnet_id_) ||
564 (query_eof)) {
565 // Generate a totals only row
566 addValueRow6(value_rows, cur_id, 0, 0, 0);
567 continue;
568 }
569
570 // Current subnet matches query row, so iterate over
571 // its query rows and accumulate them into a result-set row.
572 int64_t assigned = 0;
573 int64_t declined = 0;
574 int64_t assigned_pds = 0;
575 bool add_row = false;
576 while (!query_eof && (query_row.subnet_id_ == cur_id)) {
577
578 if (query_row.lease_state_ == Lease::STATE_DEFAULT) {
579 add_row = true;
580 if (query_row.lease_type_ == Lease::TYPE_NA) {
581 assigned = query_row.state_count_;
582 } else {
583 assigned_pds = query_row.state_count_;
584 }
585 } else if (query_row.lease_state_ == Lease::STATE_DECLINED) {
586 add_row = true;
587 declined = query_row.state_count_;
588 }
589
590 // Get next query row
591 query_eof = !(query->getNextRow(query_row));
592 }
593
594 if (add_row) {
595 addValueRow6(value_rows, cur_id, assigned, declined, assigned_pds);
596 }
597 }
598
599 return (value_rows->size());
600}
601
604 const std::vector<std::string>& column_labels) {
605 // Create the result-set map and add it to the wrapper.
606 ElementPtr result_set = Element::createMap();
607 result_wrapper->set("result-set", result_set);
608
609 // Create the timestamp based on time now and add it to the result set.
610 boost::posix_time::ptime now(boost::posix_time::microsec_clock::universal_time());
611
613 result_set->set("timestamp", timestamp);
614
615 // Create the list of column names and add it to the result set.
617 for (auto label = column_labels.begin(); label != column_labels.end(); ++label) {
618 columns->add(Element::create(*label));
619 }
620 result_set->set("columns", columns);
621
622 // Create the empty value_rows list, add it and then return it.
623 ElementPtr value_rows = Element::createList();
624 result_set->set("rows", value_rows);
625 return (value_rows);
626}
627
628
629void
631 int64_t assigned, int64_t declined) {
633 row->add(Element::create(static_cast<int64_t>(subnet_id)));
634 row->add(Element::create(getSubnetStat(subnet_id, "total-addresses")));
635 row->add(Element::create(assigned));
636 row->add(Element::create(declined));
637 value_rows->add(row);
638}
639
640void
642 int64_t assigned, int64_t declined, int64_t assigned_pds) {
644 row->add(Element::create(static_cast<int64_t>(subnet_id)));
645 row->add(Element::create(getSubnetStat(subnet_id, "total-nas")));
646 row->add(Element::create(assigned));
647 row->add(Element::create(declined));
648 row->add(Element::create(getSubnetStat(subnet_id, "total-pds")));
649 row->add(Element::create(assigned_pds));
650 value_rows->add(row);
651}
652
653int64_t
654LeaseStatCmdsImpl::getSubnetStat(const SubnetID& subnet_id, const std::string& name) {
656 getObservation(StatsMgr::generateName("subnet", subnet_id, name));
657 if (stat) {
658 return (stat->getInteger().first);
659 }
660
661 return (0);
662}
663
664int
667 return(impl.statLease4GetHandler(handle));
668}
669
670int
673 return(impl.statLease6GetHandler(handle));
674}
675
676};
677};
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Base class that command handler implementers may use for common tasks.
Definition: cmds_impl.h:21
void setErrorResponse(hooks::CalloutHandle &handle, const std::string &text, int status=CONTROL_RESULT_ERROR)
Set the callout argument "response" to indicate an error.
Definition: cmds_impl.h:54
data::ConstElementPtr cmd_args_
Stores the command arguments extracted by a call to extractCommand.
Definition: cmds_impl.h:72
void extractCommand(hooks::CalloutHandle &handle)
Extracts the command name and arguments from a Callout handle.
Definition: cmds_impl.h:29
void setResponse(hooks::CalloutHandle &handle, data::ConstElementPtr &response)
Set the callout argument "response" to the given response.
Definition: cmds_impl.h:64
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition: data.cc:223
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition: data.cc:268
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition: data.cc:263
static CfgMgr & instance()
returns a single instance of Configuration Manager
Definition: cfgmgr.cc:25
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
Definition: cfgmgr.cc:154
static LeaseMgr & instance()
Return current lease manager.
virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery6(const SubnetID &subnet_id)
Creates and runs the IPv6 lease stats query for a single subnet.
Definition: lease_mgr.cc:279
virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery4(const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
Creates and runs the IPv4 lease stats query for a single subnet.
Definition: lease_mgr.cc:171
virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery6(const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
Creates and runs the IPv6 lease stats query for a single subnet.
Definition: lease_mgr.cc:284
virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery4(const SubnetID &subnet_id)
Creates and runs the IPv4 lease stats query for a single subnet.
Definition: lease_mgr.cc:166
virtual LeaseStatsQueryPtr startLeaseStatsQuery4()
Creates and runs the IPv4 lease stats query for all subnets.
Definition: lease_mgr.cc:161
virtual LeaseStatsQueryPtr startLeaseStatsQuery6()
Creates and runs the IPv6 lease stats query for all subnets.
Definition: lease_mgr.cc:274
SelectMode
Defines the types of selection criteria supported.
Definition: lease_mgr.h:131
Per-packet callout handle.
Wrapper class for stat-leaseX-get command parameters.
Definition: stat_cmds.cc:51
SubnetID first_subnet_id_
Specifies the subnet-id for a single subnet, or the first subnet for a subnet range.
Definition: stat_cmds.cc:55
LeaseStatsQuery::SelectMode select_mode_
Denotes the query selection mode all, subnet, or subnet range.
Definition: stat_cmds.cc:62
std::string toText()
Generate a string version of the contents.
Definition: stat_cmds.cc:65
SubnetID last_subnet_id_
Specifies the last subnet for subnet range.
Definition: stat_cmds.cc:58
Implements command handling for stat-leaseX-get commands.
Definition: stat_cmds.cc:47
uint64_t makeResultSet6(const ElementPtr &result, const Parameters &params)
Executes the lease4 query and constructs the outbound result set This method uses the command paramet...
Definition: stat_cmds.cc:489
Parameters getParameters(const ConstElementPtr &cmd_args)
Parses command arguments into stat-leaseX-get parameters.
Definition: stat_cmds.cc:309
void addValueRow6(ElementPtr value_rows, const SubnetID &subnet_id, int64_t assigned, int64_t declined, int64_t assigned_pds)
Adds a row of Lease6 stat values to a list of value rows.
Definition: stat_cmds.cc:641
int64_t getSubnetStat(const SubnetID &subnet_id, const std::string &name)
Fetches a single statistic for a subnet from StatsMgr.
Definition: stat_cmds.cc:654
void addValueRow4(ElementPtr value_rows, const SubnetID &subnet_id, int64_t assigned, int64_t declined)
Adds a row of Lease4 stat values to a list of value rows.
Definition: stat_cmds.cc:630
uint64_t makeResultSet4(const ElementPtr &result, const Parameters &params)
Executes the lease4 query and constructs the outbound result set.
Definition: stat_cmds.cc:383
int statLease6GetHandler(CalloutHandle &handle)
Provides the implementation for stat-lease6-get, isc::stat_cmds::StatCmds::statLease6GetHandler.
Definition: stat_cmds.cc:262
ElementPtr createResultSet(const ElementPtr &wrapper, const std::vector< std::string > &column_labels)
Instantiates a new "empty" result-set Element.
Definition: stat_cmds.cc:603
int statLease4GetHandler(CalloutHandle &handle)
Provides the implementation for stat-lease4-get, isc::stat_cmds::StatCmds::statLease4GetHandler.
Definition: stat_cmds.cc:215
Exception thrown no subnets fall within the selection criteria This exception is thrown when a valid ...
Definition: stat_cmds.cc:40
NotFound(const char *file, size_t line, const char *what)
Definition: stat_cmds.cc:42
int statLease4GetHandler(hooks::CalloutHandle &handle)
stat-lease4-get command handler
Definition: stat_cmds.cc:665
int statLease6GetHandler(hooks::CalloutHandle &handle)
stat-lease6-get command handler
Definition: stat_cmds.cc:671
static StatsMgr & instance()
Statistics Manager accessor method.
Definition: stats_mgr.cc:21
static std::string generateName(const std::string &context, Type index, const std::string &stat_name)
Generates statistic name in a given context.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
An abstract API for lease database.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition: macros.h:32
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
Definition: macros.h:20
const int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
boost::shared_ptr< Element > ElementPtr
Definition: data.h:22
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > > > > Subnet6Collection
A collection of Subnet6 objects.
Definition: subnet.h:843
boost::shared_ptr< LeaseStatsQuery > LeaseStatsQueryPtr
Defines a pointer to a LeaseStatsQuery.
Definition: lease_mgr.h:207
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > > > > Subnet4Collection
A collection of Subnet4 objects.
Definition: subnet.h:798
isc::log::Logger stat_cmds_logger("stat-cmds-hooks")
Definition: stat_cmds_log.h:17
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.
Definition: observation.h:261
std::string ptimeToText(boost::posix_time::ptime t)
Converts ptime structure to text.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Contains a single row of lease statistical data.
Definition: lease_mgr.h:61
int64_t state_count_
state_count The count of leases in the lease state
Definition: lease_mgr.h:120
uint32_t lease_state_
The lease_state to which the count applies.
Definition: lease_mgr.h:118
SubnetID subnet_id_
The subnet ID to which this data applies.
Definition: lease_mgr.h:114
Lease::Type lease_type_
The lease_type to which the count applies.
Definition: lease_mgr.h:116
static const uint32_t STATE_DEFAULT
A lease in the default state.
Definition: lease.h:61
static const uint32_t STATE_DECLINED
Declined lease.
Definition: lease.h:64
@ TYPE_NA
the lease contains non-temporary IPv6 address
Definition: lease.h:39
Tag for the index for searching by subnet identifier.
Definition: subnet.h:739