Kea 2.7.0
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
15#include <atomic>
16
17namespace isc {
18namespace perfmon {
19
49
58public:
61
63 explicit DurationKeyParser() = default;
64
66 ~DurationKeyParser() = default;
67
79 static uint16_t getMessageType(data::ConstElementPtr config,
80 uint16_t family,
81 const std::string& param_name,
82 bool required = true);
83
90 static uint16_t getMessageNameType4(const std::string& name);
91
98 static uint16_t getMessageNameType6(const std::string& name);
99
104 static DurationKeyPtr parse(data::ConstElementPtr config, uint16_t family);
105
112};
113
116public:
119
121 explicit AlarmParser();
122
124 ~AlarmParser() = default;
125
130 static AlarmPtr parse(data::ConstElementPtr config, uint16_t family);
131};
132
136public:
139
142
144 explicit PerfMonConfig(uint16_t family);
145
147 virtual ~PerfMonConfig() = default;
148
154 void parse(data::ConstElementPtr config);
155
164
168 bool getEnableMonitoring() const {
169 return (enable_monitoring_);
170 }
171
175 void setEnableMonitoring(bool value) {
176 enable_monitoring_ = value;
177 }
178
182 uint32_t getIntervalWidthSecs() const {
183 return (interval_width_secs_);
184 }
185
189 void setIntervalWidthSecs(uint32_t value) {
190 interval_width_secs_ = value;
191 }
192
196 bool getStatsMgrReporting() const {
197 return (stats_mgr_reporting_);
198 };
199
203 void setStatsMgrReporting(bool value) {
204 stats_mgr_reporting_ = value;
205 }
206
210 uint32_t getAlarmReportSecs() const {
211 return (alarm_report_secs_);
212 }
213
217 void setAlarmReportSecs(uint32_t value) {
218 alarm_report_secs_ = value;
219 }
220
224 uint16_t getFamily() {
225 return (family_);
226 }
227
232 return (alarm_store_);
233 }
234
235protected:
237 uint16_t family_;
238
243 std::atomic<bool> enable_monitoring_;
244
248
251 std::atomic<bool> stats_mgr_reporting_;
252
256
259};
260
262typedef boost::shared_ptr<PerfMonConfig> PerfMonConfigPtr;
263
264} // end of namespace perfmon
265} // end of namespace isc
266
267#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.
PerfMonConfig(uint16_t family)
Constructor.
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.
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.
AlarmStorePtr alarm_store_
Stores the configured alarms.
std::atomic< bool > stats_mgr_reporting_
If true durations report to StatsMgr at the end of each interval.
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.
std::atomic< bool > enable_monitoring_
If true, performance data is processed/reported.
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
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.