Kea 2.5.9
perfmon_config.h
Go to the documentation of this file.
1// Copyright (C) 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#ifndef PERFMON_CONFIG_H
8#define PERFMON_CONFIG_H
9
10#include <cc/data.h>
11#include <cc/simple_parser.h>
12#include <alarm_store.h>
13#include <monitored_duration.h>
14
15namespace isc {
16namespace perfmon {
17
47
56public:
59
61 explicit DurationKeyParser() = default;
62
64 ~DurationKeyParser() = default;
65
77 static uint16_t getMessageType(data::ConstElementPtr config,
78 uint16_t family,
79 const std::string& param_name,
80 bool required = true);
81
88 static uint16_t getMessageNameType4(const std::string& name);
89
96 static uint16_t getMessageNameType6(const std::string& name);
97
102 static DurationKeyPtr parse(data::ConstElementPtr config, uint16_t family);
103
110};
111
114public:
117
119 explicit AlarmParser();
120
122 ~AlarmParser() = default;
123
128 static AlarmPtr parse(data::ConstElementPtr config, uint16_t family);
129};
130
134public:
137
140
142 explicit PerfMonConfig(uint16_t family);
143
145 virtual ~PerfMonConfig() = default;
146
152 void parse(data::ConstElementPtr config);
153
162
166 bool getEnableMonitoring() const {
167 return (enable_monitoring_);
168 }
169
173 void setEnableMonitoring(bool value) {
174 enable_monitoring_ = value;
175 }
176
180 uint32_t getIntervalWidthSecs() const {
181 return (interval_width_secs_);
182 }
183
187 void setIntervalWidthSecs(uint32_t value) {
188 interval_width_secs_ = value;
189 }
190
194 bool getStatsMgrReporting() const {
195 return (stats_mgr_reporting_);
196 };
197
201 void setStatsMgrReporting(bool value) {
202 stats_mgr_reporting_ = value;
203 }
204
208 uint32_t getAlarmReportSecs() const {
209 return (alarm_report_secs_);
210 }
211
215 void setAlarmReportSecs(uint32_t value) {
216 alarm_report_secs_ = value;
217 }
218
222 uint16_t getFamily() {
223 return (family_);
224 }
225
230 return (alarm_store_);
231 }
232
233protected:
235 uint16_t family_;
236
242
246
250
254
257};
258
260typedef boost::shared_ptr<PerfMonConfig> PerfMonConfigPtr;
261
262} // end of namespace perfmon
263} // end of namespace isc
264
265#endif
Parses configuration parameters for a single Alarm.
static const data::SimpleKeywords CONFIG_KEYWORDS
List of valid parameters and expected types.
~AlarmParser()=default
Destructor.
static AlarmPtr parse(data::ConstElementPtr config, uint16_t family)
Parses configuration parameters for a single DurationKey.
static uint16_t getMessageType(data::ConstElementPtr config, uint16_t family, const std::string &param_name, bool required=true)
Convert a configuration parameter to family-specific message type.
~DurationKeyParser()=default
Destructor.
DurationKeyParser()=default
Constructor.
static const data::SimpleKeywords CONFIG_KEYWORDS
List of valid parameters and expected types.
static data::ElementPtr toElement(DurationKeyPtr key)
Convert a DurationKey into a map of Elements.
static uint16_t getMessageNameType6(const std::string &name)
Convert string message name to DHCP6 message type.
static DurationKeyPtr parse(data::ConstElementPtr config, uint16_t family)
Convert a map of Elements into a DurationKey.
static uint16_t getMessageNameType4(const std::string &name)
Convert string message name to DHCP message type.
Houses the PerfMon configuration parameters for a single scope (e.g.
uint32_t interval_width_secs_
Number of seconds a duration accumulates samples until reporting.
virtual ~PerfMonConfig()=default
Destructor.
void setIntervalWidthSecs(uint32_t value)
Sets the value of interval-width-secs.
bool stats_mgr_reporting_
If true durations report to StatsMgr at the end of each interval.
uint32_t alarm_report_secs_
Number of seconds between reports of a raised alarm.
bool getEnableMonitoring() const
Fetches the value of enable-monitoring.
void setEnableMonitoring(bool value)
Sets the value of enable-monitoring.
void parseAlarms(data::ConstElementPtr config)
Re-creates the AlarmStore and populates it by parsing a list of alarm elements.
void setStatsMgrReporting(bool value)
Sets the value of stats-mgr-reporting.
AlarmStorePtr getAlarmStore()
Get the alarm store.
uint16_t family_
Protocol family AF_INET or AF_INET6.
bool getStatsMgrReporting() const
Fetches the value of stats-mgr-reporting.
uint16_t getFamily()
Get protocol family.
void parse(data::ConstElementPtr config)
Extracts member values from an Element::map.
static const data::SimpleDefaults SIMPLE_DEFAULTS
List of valid parameter defaults.
bool enable_monitoring_
If true, performance data is processed/reported.
AlarmStorePtr alarm_store_
Stores the configured alarms.
uint32_t getAlarmReportSecs() const
Fetches the value of alarm-report-secs.
uint32_t getIntervalWidthSecs() const
Fetches the value of interval-width-secs.
void setAlarmReportSecs(uint32_t value)
Sets the value of alarm-report-secs.
static const data::SimpleKeywords CONFIG_KEYWORDS
List of valid parameters and expected types.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:29
std::vector< SimpleDefault > SimpleDefaults
This specifies all default values in a given scope (e.g. a subnet).
boost::shared_ptr< Element > ElementPtr
Definition: data.h:28
std::map< std::string, isc::data::Element::types > SimpleKeywords
This specifies all accepted keywords with their types.
boost::shared_ptr< DurationKey > DurationKeyPtr
Defines a pointer to a DurationKey instance.
boost::shared_ptr< AlarmStore > AlarmStorePtr
Definition: alarm_store.h:181
boost::shared_ptr< PerfMonConfig > PerfMonConfigPtr
Defines a shared pointer to a PerfMonConfig.
boost::shared_ptr< Alarm > AlarmPtr
Defines a pointer to an Alarm instance.
Definition: alarm.h:168
Defines the logger used by the top-level component of kea-lfc.