Kea 2.5.9
|
Singleton which provides overall configuration, control, and state of the PerfMon hook library. More...
#include <perfmon_mgr.h>
Public Member Functions | |
PerfMonMgr (uint16_t family) | |
Constructor. | |
virtual | ~PerfMonMgr ()=default |
Destructor. | |
void | addDurationSample (DurationKeyPtr key, const Duration &sample) |
Adds a duration sample to a MonitoredDuration. | |
void | configure (const isc::data::ConstElementPtr ¶ms) |
Parses the hook library 'parameters' element. | |
Duration | getAlarmReportInterval () |
Get the alarm report interval. | |
MonitoredDurationStorePtr | getDurationStore () |
Get the duration store. | |
Duration | getIntervalDuration () |
Get the interval duration. | |
virtual void | init () |
Sets convenience values and (re)creates the duration store. | |
void | processPktEventStack (isc::dhcp::PktPtr query, isc::dhcp::PktPtr response, const isc::dhcp::SubnetPtr subnet) |
Processes the event stack of a query packet. | |
void | reportAlarm (AlarmPtr alarm, const Duration &average) |
Emits a report for a given alarm. | |
void | reportTimerExpired () |
Handler invoked when the report timer expires. | |
Duration | reportToStatsMgr (MonitoredDurationPtr duration) |
Emits an entry to StatsMgr for a given duration. | |
void | setNextReportExpiration () |
Updates the report timer. | |
Public Member Functions inherited from isc::perfmon::PerfMonConfig | |
PerfMonConfig (uint16_t family) | |
Constructor. | |
virtual | ~PerfMonConfig ()=default |
Destructor. | |
uint32_t | getAlarmReportSecs () const |
Fetches the value of alarm-report-secs. | |
AlarmStorePtr | getAlarmStore () |
Get the alarm store. | |
bool | getEnableMonitoring () const |
Fetches the value of enable-monitoring. | |
uint16_t | getFamily () |
Get protocol family. | |
uint32_t | getIntervalWidthSecs () const |
Fetches the value of interval-width-secs. | |
bool | getStatsMgrReporting () const |
Fetches the value of stats-mgr-reporting. | |
void | parse (data::ConstElementPtr config) |
Extracts member values from an Element::map. | |
void | parseAlarms (data::ConstElementPtr config) |
Re-creates the AlarmStore and populates it by parsing a list of alarm elements. | |
void | setAlarmReportSecs (uint32_t value) |
Sets the value of alarm-report-secs. | |
void | setEnableMonitoring (bool value) |
Sets the value of enable-monitoring. | |
void | setIntervalWidthSecs (uint32_t value) |
Sets the value of interval-width-secs. | |
void | setStatsMgrReporting (bool value) |
Sets the value of stats-mgr-reporting. | |
Protected Attributes | |
Duration | alarm_report_interval_ |
Length of time between raised Alarm reports. | |
MonitoredDurationStorePtr | duration_store_ |
In-memory store of MonitoredDurations. | |
Duration | interval_duration_ |
Length of time a MonitoredDuration accumulates samples until reporting. | |
asiolink::IOServicePtr | io_service_ |
Tracks whether or not the server is processing DHCP packets. | |
const boost::scoped_ptr< std::mutex > | mutex_ |
The mutex used to protect internal state. | |
asiolink::IntervalTimerPtr | report_timer_ |
Timer which tracks the next duration due to report. | |
Protected Attributes inherited from isc::perfmon::PerfMonConfig | |
uint32_t | alarm_report_secs_ |
Number of seconds between reports of a raised alarm. | |
AlarmStorePtr | alarm_store_ |
Stores the configured alarms. | |
bool | enable_monitoring_ |
If true, performance data is processed/reported. | |
uint16_t | family_ |
Protocol family AF_INET or AF_INET6. | |
uint32_t | interval_width_secs_ |
Number of seconds a duration accumulates samples until reporting. | |
bool | stats_mgr_reporting_ |
If true durations report to StatsMgr at the end of each interval. | |
Additional Inherited Members | |
Static Public Attributes inherited from isc::perfmon::PerfMonConfig | |
static const data::SimpleKeywords | CONFIG_KEYWORDS |
List of valid parameters and expected types. | |
static const data::SimpleDefaults | SIMPLE_DEFAULTS |
List of valid parameter defaults. | |
Singleton which provides overall configuration, control, and state of the PerfMon hook library.
It owns the MonitoredDurationStore and AlarmStore instances and supplies callout and command API handlers. It derives from PerfMonConfig.
Definition at line 27 of file perfmon_mgr.h.
|
explicit |
Constructor.
family | Protocol family AF_INET or AF_INET6. |
Definition at line 28 of file perfmon_mgr.cc.
References init().
|
virtualdefault |
Destructor.
void isc::perfmon::PerfMonMgr::addDurationSample | ( | DurationKeyPtr | key, |
const Duration & | sample | ||
) |
Adds a duration sample to a MonitoredDuration.
The MonitoredDuration identified by the given key is fetched from the store and updated with the sample. If the update returns the duration this means it is time to report the duration via StatsMgr. The reported average is then checked against an alarm, if one exists. If the check returns the alarm, then the alarm has undergone a reportable event and is passed to reporting.
key | identifies the duration to update. |
sample | amount of time that elapsed between the two events identified in the key. |
Definition at line 146 of file perfmon_mgr.cc.
References alarm_report_interval_, isc::perfmon::PerfMonConfig::alarm_store_, duration_store_, reportAlarm(), and reportToStatsMgr().
Referenced by processPktEventStack().
void isc::perfmon::PerfMonMgr::configure | ( | const isc::data::ConstElementPtr & | params | ) |
Parses the hook library 'parameters' element.
params | map of configuration parameters to parse. |
Definition at line 44 of file perfmon_mgr.cc.
References init(), isc_throw, isc::data::Element::map, isc::perfmon::PerfMonConfig::parse(), isc::perfmon::PerfMonConfig::setEnableMonitoring(), and isc::Exception::what().
|
inline |
Get the alarm report interval.
Definition at line 118 of file perfmon_mgr.h.
References alarm_report_interval_.
|
inline |
Get the duration store.
Definition at line 125 of file perfmon_mgr.h.
References duration_store_.
|
inline |
Get the interval duration.
Definition at line 111 of file perfmon_mgr.h.
References interval_duration_.
|
virtual |
Sets convenience values and (re)creates the duration store.
Called by the constructor and also by configure().
Definition at line 34 of file perfmon_mgr.cc.
References alarm_report_interval_, isc::perfmon::PerfMonConfig::alarm_report_secs_, duration_store_, isc::perfmon::PerfMonConfig::family_, interval_duration_, and isc::perfmon::PerfMonConfig::interval_width_secs_.
Referenced by PerfMonMgr(), and configure().
void isc::perfmon::PerfMonMgr::processPktEventStack | ( | isc::dhcp::PktPtr | query, |
isc::dhcp::PktPtr | response, | ||
const isc::dhcp::SubnetPtr | subnet | ||
) |
Processes the event stack of a query packet.
query | query packet whose stack is to be processed. |
response | response packet generated for the query. |
subnet | selected subnet, if empty use the global subnet id. |
Definition at line 68 of file perfmon_mgr.cc.
References addDurationSample(), isc::log::DBGLVL_TRACE_DETAIL, isc::dhcp::DHCP_NOTYPE, DHCPV6_NOTYPE, isc::perfmon::PerfMonConfig::enable_monitoring_, isc::perfmon::PerfMonConfig::family_, isc_throw, LOG_DEBUG, PERFMON_DHCP4_PKT_EVENTS, PERFMON_DHCP6_PKT_EVENTS, isc::perfmon::perfmon_logger, and isc::perfmon::DurationKey::validateMessagePair().
Emits a report for a given alarm.
Emits a WARN log if the alarm state is TRIGGERED or an INFO log if it is CLEARED. This may expand in the future to accommodate additional reporting mechanisms.
alarm | Alarm to report. |
average | Duration average which caused the state transition. |
Definition at line 186 of file perfmon_mgr.cc.
References isc::perfmon::PerfMonConfig::alarm_store_, isc::perfmon::Alarm::CLEAR, isc::perfmon::Alarm::DISABLED, LOG_INFO, LOG_WARN, PERFMON_ALARM_CLEARED, PERFMON_ALARM_TRIGGERED, isc::perfmon::perfmon_logger, isc::util::ptimeToText(), and isc::perfmon::Alarm::TRIGGERED.
Referenced by addDurationSample().
void isc::perfmon::PerfMonMgr::reportTimerExpired | ( | ) |
Handler invoked when the report timer expires.
Fetches a list of the durations which are overdue to report and submits them for reporting.
Definition at line 213 of file perfmon_mgr.cc.
References isc_throw.
Duration isc::perfmon::PerfMonMgr::reportToStatsMgr | ( | MonitoredDurationPtr | duration | ) |
Emits an entry to StatsMgr for a given duration.
Calculates the average duration for the reportable interval and reports the value to StatsMgr if stat-mgr-reporting is true.
duration | duration to report. |
Definition at line 164 of file perfmon_mgr.cc.
References isc::perfmon::PerfMonConfig::getStatsMgrReporting(), isc::stats::StatsMgr::instance(), isc_throw, and isc::stats::StatsMgr::setValue().
Referenced by addDurationSample().
void isc::perfmon::PerfMonMgr::setNextReportExpiration | ( | ) |
Updates the report timer.
MonitoredDurationPtr next = durations->getReportsNext() if next reschedule report timer for (next->getIntervalStart() + interval_duration_); else cancel report timer
Definition at line 218 of file perfmon_mgr.cc.
References isc_throw.
|
protected |
Length of time between raised Alarm reports.
It's a conversion of alarm-report-secs to a Duration set during configuration parsing.
Definition at line 136 of file perfmon_mgr.h.
Referenced by addDurationSample(), getAlarmReportInterval(), and init().
|
protected |
In-memory store of MonitoredDurations.
Definition at line 139 of file perfmon_mgr.h.
Referenced by addDurationSample(), getDurationStore(), and init().
|
protected |
Length of time a MonitoredDuration accumulates samples until reporting.
Definition at line 131 of file perfmon_mgr.h.
Referenced by getIntervalDuration(), and init().
|
protected |
Tracks whether or not the server is processing DHCP packets.
IOService instance used by the timer.
Definition at line 149 of file perfmon_mgr.h.
|
protected |
The mutex used to protect internal state.
Definition at line 155 of file perfmon_mgr.h.
|
protected |
Timer which tracks the next duration due to report.
Definition at line 152 of file perfmon_mgr.h.