Kea 2.0.1
stat_cmds.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2021 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>
23
24#include <boost/date_time/posix_time/posix_time.hpp>
25#include <string>
26
27using namespace isc::dhcp;
28using namespace isc::data;
29using namespace isc::config;
30using namespace isc::asiolink;
31using namespace isc::hooks;
32using namespace isc::stats;
33using namespace isc::util;
34using namespace std;
35
36namespace isc {
37namespace stat_cmds {
38
42class NotFound: public isc::Exception {
43public:
44 NotFound (const char* file, size_t line, const char* what) :
45 isc::Exception(file, line, what) { };
46};
47
49class LeaseStatCmdsImpl : private CmdsImpl {
50public:
51
53 class Parameters {
54 public:
58
61
65
67 std::string toText() {
68 std::stringstream os;
69 switch (select_mode_) {
70 case LeaseStatsQuery::ALL_SUBNETS:
71 os << "[all subnets]";
72 break;
73 case LeaseStatsQuery::SINGLE_SUBNET:
74 os << "[subnet-id=" << first_subnet_id_ << "]";
75 break;
76 case LeaseStatsQuery::SUBNET_RANGE:
77 os << "[subnets " << first_subnet_id_
78 << " through " << last_subnet_id_ << "]";
79 break;
80 }
81
82 return (os.str());
83 }
84 };
85
86public:
87
99 int
101
113 int
115
125 Parameters getParameters(const ConstElementPtr& cmd_args);
126
144 uint64_t makeResultSet4(const ElementPtr& result, const Parameters& params);
145
162 uint64_t makeResultSet6(const ElementPtr& result, const Parameters& params);
163
184 const std::vector<std::string>& column_labels);
185
193 void addValueRow4(ElementPtr value_rows, const SubnetID &subnet_id,
194 int64_t assigned, int64_t declined);
195
204 void addValueRow6(ElementPtr value_rows, const SubnetID &subnet_id,
205 int64_t assigned, int64_t declined, int64_t assigned_pds);
206
213 int64_t getSubnetStat(const SubnetID& subnet_id, const std::string& name);
214};
215
216int
218 ElementPtr result = Element::createMap();
219 Parameters params;
220 ConstElementPtr response;
221
222 // Extract the command and then the parameters
223 try {
224 extractCommand(handle);
225 params = getParameters(cmd_args_);
226 } catch (const std::exception& ex) {
228 .arg(ex.what());
229 setErrorResponse(handle, ex.what());
230 return (1);
231 }
232
233 try {
234 // Now build the result set
235 uint64_t rows = makeResultSet4(result, params);
237 .arg(params.toText())
238 .arg(rows);
239 std::stringstream os;
240 os << "stat-lease4-get" << params.toText() << ": " << rows << " rows found";
241 response = createAnswer(CONTROL_RESULT_SUCCESS, os.str(), result);
242 } catch (const NotFound& ex) {
243 // Criteria was valid but included no known subnets,
244 // so we return a not found response.
246 .arg(params.toText())
247 .arg(ex.what());
248 std::stringstream os;
249 os << "stat-lease4-get" << params.toText() << ": no matching data, " << ex.what();
250 response = createAnswer(CONTROL_RESULT_EMPTY, os.str(), result);
251 } catch (const std::exception& ex) {
253 .arg(params.toText())
254 .arg(ex.what());
255 setErrorResponse(handle, ex.what());
256 return (1);
257 }
258
259 setResponse(handle, response);
260 return (0);
261}
262
263int
265 ElementPtr result = Element::createMap();
266 Parameters params;
267 ConstElementPtr response;
268
269 // Extract the command and then the parameters
270 try {
271 extractCommand(handle);
272 params = getParameters(cmd_args_);
273 } catch (const std::exception& ex) {
275 .arg(ex.what());
276 setErrorResponse(handle, ex.what());
277 return (1);
278 }
279
280 try {
281 // Now build the result set
282 uint64_t rows = makeResultSet6(result, params);
284 .arg(params.toText())
285 .arg(rows);
286 std::stringstream os;
287 os << "stat-lease6-get" << params.toText() << ": " << rows << " rows found";
288 response = createAnswer(CONTROL_RESULT_SUCCESS, os.str(), result);
289 } catch (const NotFound& ex) {
290 // Criteria was valid but included no known subnets,
291 // so we return a not found response.
293 .arg(params.toText())
294 .arg(ex.what());
295 std::stringstream os;
296 os << "stat-lease6-get" << params.toText() << ": no matching data, " << ex.what();
297 response = createAnswer(CONTROL_RESULT_EMPTY, os.str(), result);
298 } catch (const std::exception& ex) {
300 .arg(params.toText())
301 .arg(ex.what());
302 setErrorResponse(handle, ex.what());
303 return (1);
304 }
305
306 setResponse(handle, response);
307 return (0);
308}
309
312 Parameters params;
313
314 params.select_mode_ = LeaseStatsQuery::ALL_SUBNETS;
315 params.first_subnet_id_ = 0;
316 params.last_subnet_id_ = 0;
317 if (!cmd_args ) {
318 // No arguments defaults to ALL_SUBNETS.
319 return (params);
320 }
321
322 if (cmd_args->getType() != Element::map) {
323 isc_throw(BadValue, "'arguments' parameter is not a map");
324 }
325
326 params.select_mode_ = LeaseStatsQuery::ALL_SUBNETS;
327 if (cmd_args->contains("subnet-id")) {
328
329 ConstElementPtr value = cmd_args->get("subnet-id");
330 if (value->getType() != Element::integer) {
331 isc_throw(BadValue, "'subnet-id' parameter is not integer");
332 }
333
334 if (value->intValue() <= 0) {
335 isc_throw(BadValue, "'subnet-id' parameter must be > 0");
336 }
337
338 params.first_subnet_id_ = value->intValue();
339 params.select_mode_ = LeaseStatsQuery::SINGLE_SUBNET;
340 }
341
342 if (cmd_args->contains("subnet-range")) {
343 if (params.select_mode_ == LeaseStatsQuery::SINGLE_SUBNET) {
344 isc_throw(BadValue, "cannot specify both subnet-id and subnet-range");
345 }
346
347 ConstElementPtr range = cmd_args->get("subnet-range");
348 if (range->getType() != Element::map) {
349 isc_throw(BadValue, "subnet-range parameter is not a map");
350 }
351
352 ConstElementPtr value = range->get("first-subnet-id");
353 if (!value || value->getType() != Element::integer) {
354 isc_throw(BadValue, "'first-subnet-id' parameter missing or not an integer");
355 }
356
357 if (value->intValue() <= 0) {
358 isc_throw(BadValue, "'first-subnet-id' parameter must be > 0");
359 }
360
361 params.first_subnet_id_ = value->intValue();
362
363 value = range->get("last-subnet-id");
364 if (!value || value->getType() != Element::integer) {
365 isc_throw(BadValue, "'last-subnet-id' parameter missing or not an integer");
366 }
367
368 if (value->intValue() <= 0) {
369 isc_throw(BadValue, "'last-subnet-id' parameter must be > 0");
370 }
371
372 params.last_subnet_id_ = value->intValue();
373
374 if (params.last_subnet_id_ < params.first_subnet_id_) {
375 isc_throw(BadValue, "'last-subnet-id' must be greater than 'first-subnet-id'");
376 }
377
378 params.select_mode_ = LeaseStatsQuery::SUBNET_RANGE;
379 }
380
381 return (params);
382}
383
384uint64_t
386 const Parameters& params) {
387 // First we need to determine the range of configured subnets
388 // which meet the selection criteria. If the range contains
389 // no subnets we punt.
390 const Subnet4Collection* subnets =
391 CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll();
392 const auto& idx = subnets->get<SubnetSubnetIdIndexTag>();
393
394 // Init to ALL so we can use auto ;)
395 auto lower = idx.begin();
396 auto upper = idx.end();
397 switch (params.select_mode_) {
398 case LeaseStatsQuery::SINGLE_SUBNET:
399 lower = idx.find(params.first_subnet_id_);
400 // If it's an unknown subnet, punt.
401 if (lower == idx.end()) {
402 isc_throw(NotFound, "subnet-id: "
403 << params.first_subnet_id_ << " does not exist");
404 }
405
406 upper = idx.upper_bound(params.first_subnet_id_);
407 break;
408 case LeaseStatsQuery::SUBNET_RANGE:
409 lower = idx.lower_bound(params.first_subnet_id_);
410 upper = idx.upper_bound(params.last_subnet_id_);
411 break;
412 default:
413 break;
414 }
415
416 // If it's an empty range, punt.
417 if (lower == upper) {
418 isc_throw(NotFound, "selected ID range: "
419 << params.first_subnet_id_ << " through "
420 << params.last_subnet_id_ << " includes no known subnets");
421 }
422
423 // Now, that we have a valid range, run the Lease query.
424 LeaseStatsQueryPtr query;
425 switch (params.select_mode_) {
426 case LeaseStatsQuery::ALL_SUBNETS:
427 query = LeaseMgrFactory::instance().startLeaseStatsQuery4();
428 break;
429 case LeaseStatsQuery::SINGLE_SUBNET:
430 query = LeaseMgrFactory::instance()
431 .startSubnetLeaseStatsQuery4(params.first_subnet_id_);
432 break;
433 case LeaseStatsQuery::SUBNET_RANGE:
434 query = LeaseMgrFactory::instance()
435 .startSubnetRangeLeaseStatsQuery4(params.first_subnet_id_,
436 params.last_subnet_id_);
437 break;
438 }
439
440 // Create the empty result-set.
441 std::vector<std::string>column_labels = { "subnet-id", "total-addresses",
442 "cumulative-assigned-addresses",
443 "assigned-addresses",
444 "declined-addresses" };
445 ElementPtr value_rows = createResultSet(result_wrapper, column_labels);
446
447 // Get the first query row
448 LeaseStatsRow query_row;
449 bool query_eof = !(query->getNextRow(query_row));
450
451 // Now we iterate over the selected range, building rows accordingly.
452 for (auto cur_subnet = lower; cur_subnet != upper; ++cur_subnet) {
453 SubnetID cur_id = (*cur_subnet)->getID();
454
455 // Add total only rows for subnets that occur before,
456 // in-between, or after the subnets in the query content
457 if ((cur_id < query_row.subnet_id_) ||
458 (cur_id > query_row.subnet_id_) ||
459 (query_eof)) {
460 // Generate a totals only row
461 addValueRow4(value_rows, cur_id, 0, 0);
462 continue;
463 }
464
465 // Current subnet matches query row, so iterate over its
466 // query rows (one per state) and accumulate them
467 // into a result-set row.
468 int64_t assigned = 0;
469 int64_t declined = 0;
470 bool add_row = false;
471 while (!query_eof && (query_row.subnet_id_ == cur_id)) {
472 if (query_row.lease_state_ == Lease::STATE_DEFAULT) {
473 add_row = true;
474 assigned = query_row.state_count_;
475 } else if (query_row.lease_state_ == Lease::STATE_DECLINED) {
476 add_row = true;
477 declined = query_row.state_count_;
478 }
479
480 query_eof = !(query->getNextRow(query_row));
481 }
482
483 // Add the row for the current subnet
484 if (add_row) {
485 addValueRow4(value_rows, cur_id, assigned, declined);
486 }
487 }
488
489 return (value_rows->size());
490}
491
492uint64_t
494 const Parameters& params) {
495 // Iterate over the selected range of configured subnets generating
496 // a result-set row for each one. If a subnet has data in the query
497 // content use it, otherwise, it gets a row with totals only. This
498 // way we send back a row for every selected subnet.
499 const Subnet6Collection* subnets =
500 CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll();
501
502 // Set the bounds on the selected subnet range
503 const auto& idx = subnets->get<SubnetSubnetIdIndexTag>();
504
505 // Init to all so we can use auto ;)
506 auto lower = idx.begin();
507 auto upper = idx.end();
508 switch (params.select_mode_) {
509 case LeaseStatsQuery::SINGLE_SUBNET:
510 lower = idx.lower_bound(params.first_subnet_id_);
511 // If it's an unknown subnet, punt.
512 if (lower == idx.end()) {
513 isc_throw(NotFound, "subnet-id: "
514 << params.first_subnet_id_ << " does not exist");
515 }
516
517 upper = idx.upper_bound(params.first_subnet_id_);
518 break;
519 case LeaseStatsQuery::SUBNET_RANGE:
520 lower = idx.lower_bound(params.first_subnet_id_);
521 upper = idx.upper_bound(params.last_subnet_id_);
522 break;
523 default:
524 break;
525 }
526
527 // If it's empty range, punt.
528 if (lower == upper) {
529 isc_throw(NotFound, "selected ID range: "
530 << params.first_subnet_id_ << " through "
531 << params.last_subnet_id_ << " includes no known subnets");
532 }
533
534 // Create the result-set map.
535 // labels could be class statics?
536 std::vector<std::string>column_labels = { "subnet-id", "total-nas",
537 "cumulative-assigned-nas",
538 "assigned-nas",
539 "declined-nas", "total-pds",
540 "cumulative-assigned-pds",
541 "assigned-pds" };
542 ElementPtr value_rows = createResultSet(result_wrapper, column_labels);
543
544 // Now we can run the stats query.
545 LeaseStatsQueryPtr query;
546 switch (params.select_mode_) {
547 case LeaseStatsQuery::ALL_SUBNETS:
548 query = LeaseMgrFactory::instance().startLeaseStatsQuery6();
549 break;
550 case LeaseStatsQuery::SINGLE_SUBNET:
551 query = LeaseMgrFactory::instance()
552 .startSubnetLeaseStatsQuery6(params.first_subnet_id_);
553 break;
554 case LeaseStatsQuery::SUBNET_RANGE:
555 query = LeaseMgrFactory::instance()
556 .startSubnetRangeLeaseStatsQuery6(params.first_subnet_id_,
557 params.last_subnet_id_);
558 break;
559 }
560
561 // Get the first query row
562 LeaseStatsRow query_row;
563 bool query_eof = !(query->getNextRow(query_row));
564
565 for (auto cur_subnet = lower; cur_subnet != upper; ++cur_subnet) {
566 SubnetID cur_id = (*cur_subnet)->getID();
567
568 // Add total only rows for subnets that occur before,
569 // in-between, or after subnets in the query content
570 if ((cur_id < query_row.subnet_id_) ||
571 (cur_id > query_row.subnet_id_) ||
572 (query_eof)) {
573 // Generate a totals only row
574 addValueRow6(value_rows, cur_id, 0, 0, 0);
575 continue;
576 }
577
578 // Current subnet matches query row, so iterate over
579 // its query rows and accumulate them into a result-set row.
580 int64_t assigned = 0;
581 int64_t declined = 0;
582 int64_t assigned_pds = 0;
583 bool add_row = false;
584 while (!query_eof && (query_row.subnet_id_ == cur_id)) {
585
586 if (query_row.lease_state_ == Lease::STATE_DEFAULT) {
587 add_row = true;
588 if (query_row.lease_type_ == Lease::TYPE_NA) {
589 assigned = query_row.state_count_;
590 } else {
591 assigned_pds = query_row.state_count_;
592 }
593 } else if (query_row.lease_state_ == Lease::STATE_DECLINED) {
594 add_row = true;
595 declined = query_row.state_count_;
596 }
597
598 // Get next query row
599 query_eof = !(query->getNextRow(query_row));
600 }
601
602 if (add_row) {
603 addValueRow6(value_rows, cur_id, assigned, declined, assigned_pds);
604 }
605 }
606
607 return (value_rows->size());
608}
609
612 const std::vector<std::string>& column_labels) {
613 // Create the result-set map and add it to the wrapper.
614 ElementPtr result_set = Element::createMap();
615 result_wrapper->set("result-set", result_set);
616
617 // Create the timestamp based on time now and add it to the result set.
618 boost::posix_time::ptime now(boost::posix_time::microsec_clock::universal_time());
619
620 ElementPtr timestamp = Element::create(isc::util::ptimeToText(now));
621 result_set->set("timestamp", timestamp);
622
623 // Create the list of column names and add it to the result set.
624 ElementPtr columns = Element::createList();
625 for (auto label = column_labels.begin(); label != column_labels.end(); ++label) {
626 columns->add(Element::create(*label));
627 }
628 result_set->set("columns", columns);
629
630 // Create the empty value_rows list, add it and then return it.
631 ElementPtr value_rows = Element::createList();
632 result_set->set("rows", value_rows);
633 return (value_rows);
634}
635
636
637void
639 int64_t assigned, int64_t declined) {
640 ElementPtr row = Element::createList();
641 row->add(Element::create(static_cast<int64_t>(subnet_id)));
642 row->add(Element::create(getSubnetStat(subnet_id, "total-addresses")));
643 row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-addresses")));
644 row->add(Element::create(assigned));
645 row->add(Element::create(declined));
646 value_rows->add(row);
647}
648
649void
651 int64_t assigned, int64_t declined, int64_t assigned_pds) {
652 ElementPtr row = Element::createList();
653 row->add(Element::create(static_cast<int64_t>(subnet_id)));
654 row->add(Element::create(getSubnetStat(subnet_id, "total-nas")));
655 row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-nas")));
656 row->add(Element::create(assigned));
657 row->add(Element::create(declined));
658 row->add(Element::create(getSubnetStat(subnet_id, "total-pds")));
659 row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-pds")));
660 row->add(Element::create(assigned_pds));
661 value_rows->add(row);
662}
663
664int64_t
665LeaseStatCmdsImpl::getSubnetStat(const SubnetID& subnet_id, const std::string& name) {
666 ObservationPtr stat = StatsMgr::instance().
667 getObservation(StatsMgr::generateName("subnet", subnet_id, name));
668 if (stat) {
669 return (stat->getInteger().first);
670 }
671
672 return (0);
673}
674
675// Using a critical section to avoid any changes in parallel.
676
677int
679 try {
682 return (impl.statLease4GetHandler(handle));
683 } catch (const std::exception& ex) {
684
686 .arg(ex.what());
687 }
688 return (1);
689}
690
691int
693 try {
696 return (impl.statLease6GetHandler(handle));
697 } catch (const std::exception& ex) {
698
700 .arg(ex.what());
701 }
702 return (1);
703}
704
705};
706};
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
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:53
SubnetID first_subnet_id_
Specifies the subnet-id for a single subnet, or the first subnet for a subnet range.
Definition: stat_cmds.cc:57
LeaseStatsQuery::SelectMode select_mode_
Denotes the query selection mode all, subnet, or subnet range.
Definition: stat_cmds.cc:64
std::string toText()
Generate a string version of the contents.
Definition: stat_cmds.cc:67
SubnetID last_subnet_id_
Specifies the last subnet for subnet range.
Definition: stat_cmds.cc:60
Implements command handling for stat-leaseX-get commands.
Definition: stat_cmds.cc:49
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:493
Parameters getParameters(const ConstElementPtr &cmd_args)
Parses command arguments into stat-leaseX-get parameters.
Definition: stat_cmds.cc:311
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:650
int64_t getSubnetStat(const SubnetID &subnet_id, const std::string &name)
Fetches a single statistic for a subnet from StatsMgr.
Definition: stat_cmds.cc:665
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:638
uint64_t makeResultSet4(const ElementPtr &result, const Parameters &params)
Executes the lease4 query and constructs the outbound result set.
Definition: stat_cmds.cc:385
int statLease6GetHandler(CalloutHandle &handle)
Provides the implementation for stat-lease6-get, isc::stat_cmds::StatCmds::statLease6GetHandler.
Definition: stat_cmds.cc:264
ElementPtr createResultSet(const ElementPtr &wrapper, const std::vector< std::string > &column_labels)
Instantiates a new "empty" result-set Element.
Definition: stat_cmds.cc:611
int statLease4GetHandler(CalloutHandle &handle)
Provides the implementation for stat-lease4-get, isc::stat_cmds::StatCmds::statLease4GetHandler.
Definition: stat_cmds.cc:217
Exception thrown no subnets fall within the selection criteria This exception is thrown when a valid ...
Definition: stat_cmds.cc:42
NotFound(const char *file, size_t line, const char *what)
Definition: stat_cmds.cc:44
int statLease4GetHandler(hooks::CalloutHandle &handle)
stat-lease4-get command handler
Definition: stat_cmds.cc:678
int statLease6GetHandler(hooks::CalloutHandle &handle)
stat-lease6-get command handler
Definition: stat_cmds.cc:692
RAII class creating a critical section.
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(const int status_code, const std::string &text, const ConstElementPtr &arg)
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
boost::shared_ptr< LeaseStatsQuery > LeaseStatsQueryPtr
Defines a pointer to a LeaseStatsQuery.
Definition: lease_mgr.h:207
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< 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< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet6Collection
A collection of Subnet6 objects.
Definition: subnet.h:914
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< 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 > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet4Collection
A collection of Subnet4 objects.
Definition: subnet.h:867
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24
FlexOptionImplPtr impl
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:440
Definition: edns.h:19
std::string ptimeToText(boost::posix_time::ptime t, size_t fsecs_precision=MAX_FSECS_PRECISION)
Converts ptime structure to text.
Defines the logger used by the top-level component of kea-lfc.
const isc::log::MessageID STAT_CMDS_LEASE4_GET_INVALID
const isc::log::MessageID STAT_CMDS_LEASE6_GET_INVALID
const isc::log::MessageID STAT_CMDS_LEASE6_FAILED
const isc::log::MessageID STAT_CMDS_LEASE6_GET
const isc::log::MessageID STAT_CMDS_LEASE4_FAILED
const isc::log::MessageID STAT_CMDS_LEASE6_GET_FAILED
const isc::log::MessageID STAT_CMDS_LEASE4_GET_NO_SUBNETS
const isc::log::MessageID STAT_CMDS_LEASE6_GET_NO_SUBNETS
const isc::log::MessageID STAT_CMDS_LEASE4_GET_FAILED
const isc::log::MessageID STAT_CMDS_LEASE4_GET
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
Tag for the index for searching by subnet identifier.
Definition: subnet.h:802