Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::resource_threshold_monitor Class Reference

#include <system_resource_collector.h>

Collaboration diagram for kcenon::monitoring::resource_threshold_monitor:
Collaboration graph

Classes

struct  alert
 
struct  thresholds
 

Public Member Functions

 resource_threshold_monitor (const thresholds &config)
 
std::vector< alertcheck_thresholds (const system_resources &resources)
 
void update_thresholds (const thresholds &config)
 
thresholds get_thresholds () const
 
std::vector< alertget_alert_history (size_t max_count=100) const
 
void clear_history ()
 

Private Member Functions

void check_cpu_usage (std::vector< alert > &alerts, const system_resources &resources)
 
void check_memory_usage (std::vector< alert > &alerts, const system_resources &resources)
 
void check_disk_usage (std::vector< alert > &alerts, const system_resources &resources)
 
void check_swap_usage (std::vector< alert > &alerts, const system_resources &resources)
 
void add_alert (std::vector< alert > &alerts, const std::string &resource, alert::severity level, double value, double threshold, const std::string &message)
 

Private Attributes

std::mutex config_mutex_
 
thresholds config_
 
std::mutex history_mutex_
 
std::vector< alertalert_history_
 
const size_t max_history_size_ {1000}
 

Detailed Description

Resource threshold monitor Monitors system resources against configured thresholds

Definition at line 411 of file system_resource_collector.h.

Constructor & Destructor Documentation

◆ resource_threshold_monitor()

kcenon::monitoring::resource_threshold_monitor::resource_threshold_monitor ( const thresholds & config)
explicit

Member Function Documentation

◆ add_alert()

void kcenon::monitoring::resource_threshold_monitor::add_alert ( std::vector< alert > & alerts,
const std::string & resource,
alert::severity level,
double value,
double threshold,
const std::string & message )
private

◆ check_cpu_usage()

void kcenon::monitoring::resource_threshold_monitor::check_cpu_usage ( std::vector< alert > & alerts,
const system_resources & resources )
private

◆ check_disk_usage()

void kcenon::monitoring::resource_threshold_monitor::check_disk_usage ( std::vector< alert > & alerts,
const system_resources & resources )
private

◆ check_memory_usage()

void kcenon::monitoring::resource_threshold_monitor::check_memory_usage ( std::vector< alert > & alerts,
const system_resources & resources )
private

◆ check_swap_usage()

void kcenon::monitoring::resource_threshold_monitor::check_swap_usage ( std::vector< alert > & alerts,
const system_resources & resources )
private

◆ check_thresholds()

std::vector< alert > kcenon::monitoring::resource_threshold_monitor::check_thresholds ( const system_resources & resources)

Check resources against thresholds

Parameters
resourcesSystem resources to check
Returns
Vector of triggered alerts

◆ clear_history()

void kcenon::monitoring::resource_threshold_monitor::clear_history ( )

Clear alert history

◆ get_alert_history()

std::vector< alert > kcenon::monitoring::resource_threshold_monitor::get_alert_history ( size_t max_count = 100) const

Get alert history

Parameters
max_countMaximum number of alerts to return
Returns
Vector of recent alerts

◆ get_thresholds()

thresholds kcenon::monitoring::resource_threshold_monitor::get_thresholds ( ) const

Get current threshold configuration

Returns
Current thresholds

◆ update_thresholds()

void kcenon::monitoring::resource_threshold_monitor::update_thresholds ( const thresholds & config)

Update threshold configuration

Parameters
configNew threshold values

Member Data Documentation

◆ alert_history_

std::vector<alert> kcenon::monitoring::resource_threshold_monitor::alert_history_
private

Definition at line 473 of file system_resource_collector.h.

◆ config_

thresholds kcenon::monitoring::resource_threshold_monitor::config_
private

Definition at line 470 of file system_resource_collector.h.

◆ config_mutex_

std::mutex kcenon::monitoring::resource_threshold_monitor::config_mutex_
mutableprivate

Definition at line 469 of file system_resource_collector.h.

◆ history_mutex_

std::mutex kcenon::monitoring::resource_threshold_monitor::history_mutex_
mutableprivate

Definition at line 472 of file system_resource_collector.h.

◆ max_history_size_

const size_t kcenon::monitoring::resource_threshold_monitor::max_history_size_ {1000}
private

Definition at line 474 of file system_resource_collector.h.

474{1000};

The documentation for this class was generated from the following file: