|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
#include <smart_collector.h>


Public Member Functions | |
| smart_collector () | |
| ~smart_collector ()=default | |
| smart_collector (const smart_collector &)=delete | |
| smart_collector & | operator= (const smart_collector &)=delete |
| smart_collector (smart_collector &&)=delete | |
| smart_collector & | operator= (smart_collector &&)=delete |
| auto | name () const -> std::string_view override |
| Get the unique name of this plugin. | |
| auto | collect () -> std::vector< metric > override |
| Collect current metrics from this plugin. | |
| auto | interval () const -> std::chrono::milliseconds override |
| Get the collection interval for this plugin. | |
| auto | is_available () const -> bool override |
| Check if this plugin is available on the current system. | |
| bool | is_healthy () const |
| auto | get_metric_types () const -> std::vector< std::string > override |
| Get supported metric types. | |
| bool | initialize (const std::unordered_map< std::string, std::string > &config) override |
| std::unordered_map< std::string, double > | get_statistics () const override |
| std::vector< smart_disk_metrics > | get_last_metrics () const |
| bool | is_smart_available () const |
Public Member Functions inherited from kcenon::monitoring::collector_plugin | |
| virtual | ~collector_plugin ()=default |
| virtual auto | get_metadata () const -> plugin_metadata |
| Get plugin metadata. | |
| virtual void | shutdown () |
| Shutdown plugin and release resources. | |
Private Member Functions | |
| metric | create_metric (const std::string &name, double value, const smart_disk_metrics &disk, const std::string &unit="") const |
| void | add_disk_metrics (std::vector< metric > &metrics, const smart_disk_metrics &disk) |
Private Attributes | |
| std::unique_ptr< smart_info_collector > | collector_ |
| bool | enabled_ {true} |
| bool | collect_temperature_ {true} |
| bool | collect_error_rates_ {true} |
| std::chrono::milliseconds | collection_interval_ {std::chrono::seconds(300)} |
| std::mutex | stats_mutex_ |
| std::atomic< size_t > | collection_count_ {0} |
| std::atomic< size_t > | collection_errors_ {0} |
| std::atomic< size_t > | disks_found_ {0} |
| std::vector< smart_disk_metrics > | last_metrics_ |
SMART disk health collector implementing the collector_plugin interface
Collects S.M.A.R.T. disk health data using smartctl (smartmontools). Gracefully degrades when smartctl is not available or disks don't support SMART.
Definition at line 121 of file smart_collector.h.
| kcenon::monitoring::smart_collector::smart_collector | ( | ) |
|
default |
|
delete |
|
delete |
|
private |
|
overridevirtual |
Collect current metrics from this plugin.
This method is called periodically based on interval(). Implementations should:
Implements kcenon::monitoring::collector_plugin.
|
private |
| std::vector< smart_disk_metrics > kcenon::monitoring::smart_collector::get_last_metrics | ( | ) | const |
Get last collected SMART metrics
|
overridevirtual |
Get supported metric types.
Used for filtering and documentation.
Implements kcenon::monitoring::collector_plugin.
|
overridevirtual |
Get collector statistics
Reimplemented from kcenon::monitoring::collector_plugin.
|
overridevirtual |
Initialize the collector with configuration
| config | Configuration options |
Reimplemented from kcenon::monitoring::collector_plugin.
|
inlineoverridevirtual |
Get the collection interval for this plugin.
The registry uses this value to schedule collection tasks. Typical values:
Implements kcenon::monitoring::collector_plugin.
Definition at line 135 of file smart_collector.h.
References collection_interval_.
|
overridevirtual |
Check if this plugin is available on the current system.
Availability checks may include:
The registry may skip unavailable plugins during registration.
Implements kcenon::monitoring::collector_plugin.
| bool kcenon::monitoring::smart_collector::is_healthy | ( | ) | const |
Check if collector is in a healthy state
| bool kcenon::monitoring::smart_collector::is_smart_available | ( | ) | const |
Check if SMART monitoring is available
|
inlineoverridevirtual |
Get the unique name of this plugin.
The name is used for:
Implements kcenon::monitoring::collector_plugin.
Definition at line 133 of file smart_collector.h.
|
delete |
|
delete |
|
private |
Definition at line 176 of file smart_collector.h.
|
private |
Definition at line 175 of file smart_collector.h.
|
private |
Definition at line 181 of file smart_collector.h.
|
private |
Definition at line 182 of file smart_collector.h.
|
private |
Definition at line 177 of file smart_collector.h.
Referenced by interval().
|
private |
Definition at line 171 of file smart_collector.h.
|
private |
Definition at line 183 of file smart_collector.h.
|
private |
Definition at line 174 of file smart_collector.h.
|
private |
Definition at line 184 of file smart_collector.h.
|
mutableprivate |
Definition at line 180 of file smart_collector.h.