Kea 2.7.0
perfmon_mgr.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// Functions accessed by the hooks framework use C linkage to avoid the name
8// mangling that accompanies use of the C++ compiler as well as to avoid
9// issues related to namespaces.
10
11#ifndef PERFMON_MGR_H
12#define PERFMON_MGR_H
13
14#include <perfmon_config.h>
15#include <config/command_mgr.h>
16#include <config/cmds_impl.h>
18#include <asiolink/io_service.h>
20#include <dhcpsrv/subnet.h>
21
22namespace isc {
23namespace perfmon {
24
29class PerfMonMgr : public PerfMonConfig, private config::CmdsImpl {
30public:
34 explicit PerfMonMgr(uint16_t family);
35
37 virtual ~PerfMonMgr() = default;
38
42 void configure(const isc::data::ConstElementPtr& params);
43
47 virtual void init();
48
66 isc::dhcp::PktPtr response,
67 const isc::dhcp::SubnetPtr subnet);
68
81 void addDurationSample(DurationKeyPtr key, const Duration& sample);
82
92
101 void reportAlarm(AlarmPtr alarm, const Duration& mean);
102
107 void reportTimerExpired();
108
117
153
234
239
262
269
276
283
284protected:
287
292
295
301 // dhcp::NetworkStatePtr network_state_;
302
305
308
310 const boost::scoped_ptr<std::mutex> mutex_;
311};
312
314typedef boost::shared_ptr<PerfMonMgr> PerfMonMgrPtr;
315
316} // end of namespace perfmon
317} // end of namespace isc
318
319#endif
Base class that command handler implementers may use for common tasks.
Definition cmds_impl.h:21
Per-packet callout handle.
Houses the PerfMon configuration parameters for a single scope (e.g.
Singleton which provides overall configuration, control, and state of the PerfMon hook library.
Definition perfmon_mgr.h:29
void processPktEventStack(isc::dhcp::PktPtr query, isc::dhcp::PktPtr response, const isc::dhcp::SubnetPtr subnet)
Processes the event stack of a query packet.
void reportTimerExpired()
Handler invoked when the report timer expires.
Duration interval_duration_
Length of time a MonitoredDuration accumulates samples until reporting.
int perfmonGetAllDurationsHandler(hooks::CalloutHandle &handle)
perfmon-get-all-durations handler
const boost::scoped_ptr< std::mutex > mutex_
The mutex used to protect internal state.
void setNextReportExpiration()
Updates the report timer.
void addDurationSample(DurationKeyPtr key, const Duration &sample)
Adds a duration sample to a MonitoredDuration.
virtual ~PerfMonMgr()=default
Destructor.
data::ElementPtr formatDurationDataAsElements(MonitoredDurationCollectionPtr durations) const
Renders a list of MonitoredDurations as a map of individual Elements.
asiolink::IntervalTimerPtr report_timer_
Timer which tracks the next duration due to report.
Duration getIntervalDuration()
Get the interval duration.
int perfmonControlHandler(hooks::CalloutHandle &handle)
perfmon-control command handler
PerfMonMgr(uint16_t family)
Constructor.
Duration reportToStatsMgr(MonitoredDurationPtr duration)
Emits an entry to StatsMgr for a given duration.
void configure(const isc::data::ConstElementPtr &params)
Parses the hook library 'parameters' element.
MonitoredDurationStorePtr duration_store_
In-memory store of MonitoredDurations.
asiolink::IOServicePtr io_service_
Tracks whether or not the server is processing DHCP packets.
data::ElementPtr formatDurationDataAsResultSet(MonitoredDurationCollectionPtr durations) const
Renders a list of MonitoredDurations as a result set.
Duration alarm_report_interval_
Length of time between raised Alarm reports.
Duration getAlarmReportInterval()
Get the alarm report interval.
virtual void init()
Sets convenience values and (re)creates the duration store.
void reportAlarm(AlarmPtr alarm, const Duration &mean)
Emits a report for a given alarm.
MonitoredDurationStorePtr getDurationStore()
Get the duration store.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< isc::dhcp::Pkt > PktPtr
A pointer to either Pkt4 or Pkt6 packet.
Definition pkt.h:982
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
Definition subnet.h:449
boost::posix_time::time_duration Duration
boost::shared_ptr< MonitoredDurationCollection > MonitoredDurationCollectionPtr
Type for a pointer to a collection of MonitoredDurationPtrs.
boost::shared_ptr< DurationKey > DurationKeyPtr
Defines a pointer to a DurationKey instance.
boost::shared_ptr< MonitoredDurationStore > MonitoredDurationStorePtr
boost::shared_ptr< MonitoredDuration > MonitoredDurationPtr
boost::shared_ptr< Alarm > AlarmPtr
Defines a pointer to an Alarm instance.
Definition alarm.h:168
boost::shared_ptr< PerfMonMgr > PerfMonMgrPtr
Defines a shared pointer to a PerfMonMgr.
Defines the logger used by the top-level component of kea-lfc.
The classes herein parse PerfMon hook library's 'parameters' element depicted below: