Kea 2.7.5
stat_cmds.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2024 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 isc::log;
35using namespace std;
36
37namespace isc {
38namespace stat_cmds {
39
43class NotFound: public isc::Exception {
44public:
45 NotFound (const char* file, size_t line, const char* what) :
46 isc::Exception(file, line, what) { }
47};
48
50class LeaseStatCmdsImpl : private CmdsImpl {
51public:
52
54 class Parameters {
55 public:
59
62
66
68 std::string toText() {
69 std::stringstream os;
70 switch (select_mode_) {
72 os << "[all subnets]";
73 break;
75 os << "[subnet-id=" << first_subnet_id_ << "]";
76 break;
78 os << "[subnets " << first_subnet_id_
79 << " through " << last_subnet_id_ << "]";
80 break;
81 default:
82 os << "unsupported";
83 }
84
85 return (os.str());
86 }
87 };
88
89public:
90
102 int
104
116 int
118
128 Parameters getParameters(const ConstElementPtr& cmd_args);
129
147 uint64_t makeResultSet4(const ElementPtr& result, const Parameters& params);
148
165 uint64_t makeResultSet6(const ElementPtr& result, const Parameters& params);
166
187 const std::vector<std::string>& column_labels);
188
196 void addValueRow4(ElementPtr value_rows, const SubnetID &subnet_id,
197 int64_t assigned, int64_t declined);
198
207 void addValueRow6(ElementPtr value_rows, const SubnetID &subnet_id,
208 int64_t assigned, int64_t declined, int64_t assigned_pds);
209
216 int64_t getSubnetStat(const SubnetID& subnet_id, const std::string& name);
217
224 int128_t getBigSubnetStat(const SubnetID& subnet_id, const std::string& name);
225};
226
227int
230 Parameters params;
231 ConstElementPtr response;
232
233 // Extract the command and then the parameters
234 try {
235 extractCommand(handle);
236 params = getParameters(cmd_args_);
237 } catch (const std::exception& ex) {
239 .arg(ex.what());
240 setErrorResponse(handle, ex.what());
241 return (1);
242 }
243
244 try {
245 // Now build the result set
246 uint64_t rows = makeResultSet4(result, params);
248 .arg(params.toText())
249 .arg(rows);
250 std::stringstream os;
251 os << "stat-lease4-get" << params.toText() << ": " << rows << " rows found";
252 response = createAnswer(CONTROL_RESULT_SUCCESS, os.str(), result);
253 } catch (const NotFound& ex) {
254 // Criteria was valid but included no known subnets,
255 // so we return a not found response.
257 .arg(params.toText())
258 .arg(ex.what());
259 std::stringstream os;
260 os << "stat-lease4-get" << params.toText() << ": no matching data, " << ex.what();
261 response = createAnswer(CONTROL_RESULT_EMPTY, os.str(), result);
262 } catch (const std::exception& ex) {
264 .arg(params.toText())
265 .arg(ex.what());
266 setErrorResponse(handle, ex.what());
267 return (1);
268 }
269
270 setResponse(handle, response);
271 return (0);
272}
273
274int
277 Parameters params;
278 ConstElementPtr response;
279
280 // Extract the command and then the parameters
281 try {
282 extractCommand(handle);
283 params = getParameters(cmd_args_);
284 } catch (const std::exception& ex) {
286 .arg(ex.what());
287 setErrorResponse(handle, ex.what());
288 return (1);
289 }
290
291 try {
292 // Now build the result set
293 uint64_t rows = makeResultSet6(result, params);
295 .arg(params.toText())
296 .arg(rows);
297 std::stringstream os;
298 os << "stat-lease6-get" << params.toText() << ": " << rows << " rows found";
299 response = createAnswer(CONTROL_RESULT_SUCCESS, os.str(), result);
300 } catch (const NotFound& ex) {
301 // Criteria was valid but included no known subnets,
302 // so we return a not found response.
304 .arg(params.toText())
305 .arg(ex.what());
306 std::stringstream os;
307 os << "stat-lease6-get" << params.toText() << ": no matching data, " << ex.what();
308 response = createAnswer(CONTROL_RESULT_EMPTY, os.str(), result);
309 } catch (const std::exception& ex) {
311 .arg(params.toText())
312 .arg(ex.what());
313 setErrorResponse(handle, ex.what());
314 return (1);
315 }
316
317 setResponse(handle, response);
318 return (0);
319}
320
323 Parameters params;
324
326 params.first_subnet_id_ = 0;
327 params.last_subnet_id_ = 0;
328 if (!cmd_args ) {
329 // No arguments defaults to ALL_SUBNETS.
330 return (params);
331 }
332
333 if (cmd_args->getType() != Element::map) {
334 isc_throw(BadValue, "'arguments' parameter is not a map");
335 }
336
337 params.select_mode_ = LeaseStatsQuery::ALL_SUBNETS;
338 if (cmd_args->contains("subnet-id")) {
339
340 ConstElementPtr value = cmd_args->get("subnet-id");
341 if (value->getType() != Element::integer) {
342 isc_throw(BadValue, "'subnet-id' parameter is not integer");
343 }
344
345 if (value->intValue() <= 0) {
346 isc_throw(BadValue, "'subnet-id' parameter must be > 0");
347 }
348
349 params.first_subnet_id_ = value->intValue();
350 params.select_mode_ = LeaseStatsQuery::SINGLE_SUBNET;
351 }
352
353 if (cmd_args->contains("subnet-range")) {
354 if (params.select_mode_ == LeaseStatsQuery::SINGLE_SUBNET) {
355 isc_throw(BadValue, "cannot specify both subnet-id and subnet-range");
356 }
357
358 ConstElementPtr range = cmd_args->get("subnet-range");
359 if (range->getType() != Element::map) {
360 isc_throw(BadValue, "subnet-range parameter is not a map");
361 }
362
363 ConstElementPtr value = range->get("first-subnet-id");
364 if (!value || value->getType() != Element::integer) {
365 isc_throw(BadValue, "'first-subnet-id' parameter missing or not an integer");
366 }
367
368 if (value->intValue() <= 0) {
369 isc_throw(BadValue, "'first-subnet-id' parameter must be > 0");
370 }
371
372 params.first_subnet_id_ = value->intValue();
373
374 value = range->get("last-subnet-id");
375 if (!value || value->getType() != Element::integer) {
376 isc_throw(BadValue, "'last-subnet-id' parameter missing or not an integer");
377 }
378
379 if (value->intValue() <= 0) {
380 isc_throw(BadValue, "'last-subnet-id' parameter must be > 0");
381 }
382
383 params.last_subnet_id_ = value->intValue();
384
385 if (params.last_subnet_id_ < params.first_subnet_id_) {
386 isc_throw(BadValue, "'last-subnet-id' must be greater than 'first-subnet-id'");
387 }
388
389 params.select_mode_ = LeaseStatsQuery::SUBNET_RANGE;
390 }
391
392 return (params);
393}
394
395uint64_t
397 const Parameters& params) {
398 // First we need to determine the range of configured subnets
399 // which meet the selection criteria. If the range contains
400 // no subnets we punt.
401 // Iterate over the selected range of configured subnets generating
402 // a result-set row for each one. If a subnet has data in the query
403 // content use it, otherwise, it gets a row with totals only. This
404 // way we send back a row for every selected subnet.
405 const Subnet4Collection* subnets =
406 CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll();
407
408 // Set the bounds on the selected subnet range
409 auto const& idx = subnets->get<SubnetSubnetIdIndexTag>();
410
411 // Init to ALL so we can use auto
412 auto lower = idx.begin();
413 auto upper = idx.end();
414 switch (params.select_mode_) {
416 lower = idx.find(params.first_subnet_id_);
417 // If it's an unknown subnet, punt.
418 if (lower == idx.end()) {
419 isc_throw(NotFound, "subnet-id: "
420 << params.first_subnet_id_ << " does not exist");
421 }
422
423 upper = idx.upper_bound(params.first_subnet_id_);
424 break;
426 lower = idx.lower_bound(params.first_subnet_id_);
427 upper = idx.upper_bound(params.last_subnet_id_);
428 break;
429 default:
430 break;
431 }
432
433 // If it's an empty range, punt.
434 if (lower == upper) {
435 isc_throw(NotFound, "selected ID range: "
436 << params.first_subnet_id_ << " through "
437 << params.last_subnet_id_ << " includes no known subnets");
438 }
439
440 // Now we can run the stats query.
441 LeaseStatsQueryPtr query;
442 switch (params.select_mode_) {
444 query = LeaseMgrFactory::instance().startLeaseStatsQuery4();
445 break;
448 .startSubnetLeaseStatsQuery4(params.first_subnet_id_);
449 break;
452 .startSubnetRangeLeaseStatsQuery4(params.first_subnet_id_,
453 params.last_subnet_id_);
454 break;
455 default:
456 return (0);
457 }
458
459 // Create the result-set map.
460 // labels could be class statics?
461 std::vector<std::string>column_labels = { "subnet-id", "total-addresses",
462 "cumulative-assigned-addresses",
463 "assigned-addresses",
464 "declined-addresses" };
465 ElementPtr value_rows = createResultSet(result_wrapper, column_labels);
466
467 // Get the first query row
468 LeaseStatsRow query_row;
469 bool query_eof = !(query->getNextRow(query_row));
470
471 // Now we iterate over the selected range, building rows accordingly.
472 bool orphaned_stats = false;
473 for (auto cur_subnet = lower; cur_subnet != upper; ++cur_subnet) {
474 SubnetID cur_id = (*cur_subnet)->getID();
475
476 // Skip any unexpected result set rows. These occur when
477 // subnets no longer exist but either their leases (memfile)
478 // or their leaseX-stat rows (db lease backends) still do.
479 while ((cur_id > query_row.subnet_id_) && (!query_eof)) {
480 orphaned_stats = true;
481 query_eof = !(query->getNextRow(query_row));
482 }
483
484 // Add total only rows for subnets that occur before
485 // or after the subnets in the query content. These are
486 // subnets which exist but for which there is not yet any
487 // lease data.
488 if ((cur_id < query_row.subnet_id_) || (query_eof)) {
489 // Generate a totals only row
490 addValueRow4(value_rows, cur_id, 0, 0);
491 continue;
492 }
493
494 // Current subnet matches query row, so iterate over its
495 // query rows (one per state) and accumulate them
496 // into a result-set row.
497 int64_t assigned = 0;
498 int64_t declined = 0;
499 bool add_row = false;
500 while (!query_eof && (query_row.subnet_id_ == cur_id)) {
501 if (query_row.lease_state_ == Lease::STATE_DEFAULT) {
502 add_row = true;
503 assigned = query_row.state_count_;
504 } else if (query_row.lease_state_ == Lease::STATE_DECLINED) {
505 add_row = true;
506 declined = query_row.state_count_;
507 }
508
509 // Get next query row
510 query_eof = !(query->getNextRow(query_row));
511 }
512 // Add the row for the current subnet
513 if (add_row) {
514 addValueRow4(value_rows, cur_id, assigned, declined);
515 }
516 }
517
518 // If there are any orphaned statistics log it.
519 if (!(query_eof) || orphaned_stats) {
521 }
522
523 return (value_rows->size());
524}
525
526uint64_t
528 const Parameters& params) {
529 // First we need to determine the range of configured subnets
530 // which meet the selection criteria. If the range contains
531 // no subnets we punt.
532 // Iterate over the selected range of configured subnets generating
533 // a result-set row for each one. If a subnet has data in the query
534 // content use it, otherwise, it gets a row with totals only. This
535 // way we send back a row for every selected subnet.
536 const Subnet6Collection* subnets =
537 CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll();
538
539 // Set the bounds on the selected subnet range
540 auto const& idx = subnets->get<SubnetSubnetIdIndexTag>();
541
542 // Init to ALL so we can use auto
543 auto lower = idx.begin();
544 auto upper = idx.end();
545 switch (params.select_mode_) {
547 lower = idx.find(params.first_subnet_id_);
548 // If it's an unknown subnet, punt.
549 if (lower == idx.end()) {
550 isc_throw(NotFound, "subnet-id: "
551 << params.first_subnet_id_ << " does not exist");
552 }
553
554 upper = idx.upper_bound(params.first_subnet_id_);
555 break;
557 lower = idx.lower_bound(params.first_subnet_id_);
558 upper = idx.upper_bound(params.last_subnet_id_);
559 break;
560 default:
561 break;
562 }
563
564 // If it's an empty range, punt.
565 if (lower == upper) {
566 isc_throw(NotFound, "selected ID range: "
567 << params.first_subnet_id_ << " through "
568 << params.last_subnet_id_ << " includes no known subnets");
569 }
570
571 // Now we can run the stats query.
572 LeaseStatsQueryPtr query;
573 switch (params.select_mode_) {
575 query = LeaseMgrFactory::instance().startLeaseStatsQuery6();
576 break;
579 .startSubnetLeaseStatsQuery6(params.first_subnet_id_);
580 break;
583 .startSubnetRangeLeaseStatsQuery6(params.first_subnet_id_,
584 params.last_subnet_id_);
585 break;
586 default:
587 return (0);
588 }
589
590 // Create the result-set map.
591 // labels could be class statics?
592 std::vector<std::string>column_labels = { "subnet-id", "total-nas",
593 "cumulative-assigned-nas",
594 "assigned-nas",
595 "declined-addresses", "total-pds",
596 "cumulative-assigned-pds",
597 "assigned-pds" };
598 ElementPtr value_rows = createResultSet(result_wrapper, column_labels);
599
600 // Get the first query row
601 LeaseStatsRow query_row;
602 bool query_eof = !(query->getNextRow(query_row));
603
604 // Now we iterate over the selected range, building rows accordingly.
605 bool orphaned_stats = false;
606 for (auto cur_subnet = lower; cur_subnet != upper; ++cur_subnet) {
607 SubnetID cur_id = (*cur_subnet)->getID();
608
609 // Skip any unexpected result set rows. These occur when
610 // subnets no longer exist but either their leases (memfile)
611 // or their leaseX-stat rows (db lease backends) still do.
612 while ((cur_id > query_row.subnet_id_) && (!query_eof)) {
613 orphaned_stats = true;
614 query_eof = !(query->getNextRow(query_row));
615 }
616
617 // Add total only rows for subnets that occur before
618 // or after the subnets in the query content. These are
619 // subnets which exist but for which there is not yet any
620 // lease data.
621 if ((cur_id < query_row.subnet_id_) || (query_eof)) {
622 // Generate a totals only row
623 addValueRow6(value_rows, cur_id, 0, 0, 0);
624 continue;
625 }
626
627 // Current subnet matches query row, so iterate over its
628 // query rows (one per state) and accumulate them
629 // into a result-set row.
630 int64_t assigned = 0;
631 int64_t declined = 0;
632 int64_t assigned_pds = 0;
633 bool add_row = false;
634 while (!query_eof && (query_row.subnet_id_ == cur_id)) {
635 if (query_row.lease_state_ == Lease::STATE_DEFAULT) {
636 add_row = true;
637 if (query_row.lease_type_ == Lease::TYPE_NA) {
638 assigned = query_row.state_count_;
639 } else {
640 assigned_pds = query_row.state_count_;
641 }
642 } else if (query_row.lease_state_ == Lease::STATE_DECLINED) {
643 add_row = true;
644 declined = query_row.state_count_;
645 }
646
647 // Get next query row
648 query_eof = !(query->getNextRow(query_row));
649 }
650 // Add the row for the current subnet
651 if (add_row) {
652 addValueRow6(value_rows, cur_id, assigned, declined, assigned_pds);
653 }
654 }
655
656 // If there are any orphaned statistics log it.
657 if (!(query_eof) || orphaned_stats) {
659 }
660
661 return (value_rows->size());
662}
663
666 const std::vector<std::string>& column_labels) {
667 // Create the result-set map and add it to the wrapper.
668 ElementPtr result_set = Element::createMap();
669 result_wrapper->set("result-set", result_set);
670
671 // Create the timestamp based on time now and add it to the result set.
672 boost::posix_time::ptime now(boost::posix_time::microsec_clock::universal_time());
673
675 result_set->set("timestamp", timestamp);
676
677 // Create the list of column names and add it to the result set.
679 for (auto const& label : column_labels) {
680 columns->add(Element::create(label));
681 }
682 result_set->set("columns", columns);
683
684 // Create the empty value_rows list, add it and then return it.
685 ElementPtr value_rows = Element::createList();
686 result_set->set("rows", value_rows);
687 return (value_rows);
688}
689
690
691void
693 int64_t assigned, int64_t declined) {
695 row->add(Element::create(static_cast<int64_t>(subnet_id)));
696 row->add(Element::create(getSubnetStat(subnet_id, "total-addresses")));
697 row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-addresses")));
698 row->add(Element::create(assigned));
699 row->add(Element::create(declined));
700 value_rows->add(row);
701}
702
703void
705 int64_t assigned, int64_t declined, int64_t assigned_pds) {
707 row->add(Element::create(static_cast<int64_t>(subnet_id)));
708 row->add(Element::create(getBigSubnetStat(subnet_id, "total-nas")));
709 row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-nas")));
710 row->add(Element::create(assigned));
711 row->add(Element::create(declined));
712 row->add(Element::create(getBigSubnetStat(subnet_id, "total-pds")));
713 row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-pds")));
714 row->add(Element::create(assigned_pds));
715 value_rows->add(row);
716}
717
718int64_t
719LeaseStatCmdsImpl::getSubnetStat(const SubnetID& subnet_id, const std::string& name) {
721 getObservation(StatsMgr::generateName("subnet", subnet_id, name));
722 if (stat) {
723 return (stat->getInteger().first);
724 }
725
726 return (0);
727}
728
730LeaseStatCmdsImpl::getBigSubnetStat(const SubnetID& subnet_id, const std::string& name) {
732 getObservation(StatsMgr::generateName("subnet", subnet_id, name));
733 if (stat) {
734 return (stat->getBigInteger().first);
735 }
736
737 return (0);
738}
739
740// Using a critical section to avoid any changes in parallel.
741
742int
744 try {
746 return (impl.statLease4GetHandler(handle));
747 } catch (const std::exception& ex) {
748
750 .arg(ex.what());
751 }
752 return (1);
753}
754
755int
757 try {
759 return (impl.statLease6GetHandler(handle));
760 } catch (const std::exception& ex) {
761
763 .arg(ex.what());
764 }
765 return (1);
766}
767
768};
769};
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:249
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:304
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:299
static CfgMgr & instance()
returns a single instance of Configuration Manager
Definition cfgmgr.cc:28
static TrackingLeaseMgr & instance()
Return current lease manager.
SelectMode
Defines the types of selection criteria supported.
Definition lease_mgr.h:152
Per-packet callout handle.
Wrapper class for stat-leaseX-get command parameters.
Definition stat_cmds.cc:54
SubnetID first_subnet_id_
Specifies the subnet-id for a single subnet, or the first subnet for a subnet range.
Definition stat_cmds.cc:58
LeaseStatsQuery::SelectMode select_mode_
Denotes the query selection mode all, subnet, or subnet range.
Definition stat_cmds.cc:65
std::string toText()
Generate a string version of the contents.
Definition stat_cmds.cc:68
SubnetID last_subnet_id_
Specifies the last subnet for subnet range.
Definition stat_cmds.cc:61
Implements command handling for stat-leaseX-get commands.
Definition stat_cmds.cc:50
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:527
Parameters getParameters(const ConstElementPtr &cmd_args)
Parses command arguments into stat-leaseX-get parameters.
Definition stat_cmds.cc:322
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:704
int64_t getSubnetStat(const SubnetID &subnet_id, const std::string &name)
Fetches a single integer statistic for a subnet from StatsMgr.
Definition stat_cmds.cc:719
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:692
uint64_t makeResultSet4(const ElementPtr &result, const Parameters &params)
Executes the lease4 query and constructs the outbound result set.
Definition stat_cmds.cc:396
int statLease6GetHandler(CalloutHandle &handle)
Provides the implementation for stat-lease6-get, isc::stat_cmds::StatCmds::statLease6GetHandler.
Definition stat_cmds.cc:275
ElementPtr createResultSet(const ElementPtr &wrapper, const std::vector< std::string > &column_labels)
Instantiates a new "empty" result-set Element.
Definition stat_cmds.cc:665
int128_t getBigSubnetStat(const SubnetID &subnet_id, const std::string &name)
Fetches a single bigint statistic for a subnet from StatsMgr.
Definition stat_cmds.cc:730
int statLease4GetHandler(CalloutHandle &handle)
Provides the implementation for stat-lease4-get, isc::stat_cmds::StatCmds::statLease4GetHandler.
Definition stat_cmds.cc:228
Exception thrown no subnets fall within the selection criteria This exception is thrown when a valid ...
Definition stat_cmds.cc:43
NotFound(const char *file, size_t line, const char *what)
Definition stat_cmds.cc:45
int statLease4GetHandler(hooks::CalloutHandle &handle)
stat-lease4-get command handler
Definition stat_cmds.cc:743
int statLease6GetHandler(hooks::CalloutHandle &handle)
stat-lease6-get command handler
Definition stat_cmds.cc:756
static StatsMgr & instance()
Statistics Manager accessor method.
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
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
Definition macros.h:14
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:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< LeaseStatsQuery > LeaseStatsQueryPtr
Defines a pointer to a LeaseStatsQuery.
Definition lease_mgr.h:233
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:937
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:866
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
const int DBGLVL_TRACE_BASIC
Trace basic operations.
isc::log::Logger stat_cmds_logger("stat-cmds-hooks")
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.
boost::multiprecision::checked_int128_t int128_t
Definition bigints.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_LEASE6_ORPHANED_STATS
const isc::log::MessageID STAT_CMDS_LEASE4_GET_FAILED
const isc::log::MessageID STAT_CMDS_LEASE4_ORPHANED_STATS
const isc::log::MessageID STAT_CMDS_LEASE4_GET
Contains a single row of lease statistical data.
Definition lease_mgr.h:64
static const uint32_t STATE_DEFAULT
A lease in the default state.
Definition lease.h:69
static const uint32_t STATE_DECLINED
Declined lease.
Definition lease.h:72
@ TYPE_NA
the lease contains non-temporary IPv6 address
Definition lease.h:47
Tag for the index for searching by subnet identifier.
Definition subnet.h:777