24#include <unordered_map>
133 auto name() const -> std::string_view
override {
return "smart_collector"; }
134 auto collect() -> std::vector<metric>
override;
149 bool initialize(const std::unordered_map<std::
string, std::
string>& config) override;
188 const std::string& unit =
"")
const;
Pure virtual interface for metric collector plugins.
auto is_available() const -> bool override
Check if this plugin is available on the current system.
bool is_smart_available() const
std::atomic< size_t > collection_errors_
auto name() const -> std::string_view override
Get the unique name of this plugin.
smart_collector(const smart_collector &)=delete
metric create_metric(const std::string &name, double value, const smart_disk_metrics &disk, const std::string &unit="") const
bool collect_temperature_
~smart_collector()=default
auto collect() -> std::vector< metric > override
Collect current metrics from this plugin.
std::vector< smart_disk_metrics > get_last_metrics() const
std::vector< smart_disk_metrics > last_metrics_
smart_collector(smart_collector &&)=delete
bool collect_error_rates_
smart_collector & operator=(smart_collector &&)=delete
std::chrono::milliseconds collection_interval_
std::unique_ptr< smart_info_collector > collector_
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::atomic< size_t > collection_count_
auto interval() const -> std::chrono::milliseconds override
Get the collection interval for this plugin.
std::atomic< size_t > disks_found_
std::unordered_map< std::string, double > get_statistics() const override
smart_collector & operator=(const smart_collector &)=delete
void add_disk_metrics(std::vector< metric > &metrics, const smart_disk_metrics &disk)
smart_info_collector(smart_info_collector &&)=delete
smart_info_collector & operator=(const smart_info_collector &)=delete
smart_disk_metrics parse_smartctl_json(const std::string &json_output, const disk_info &info) const
smart_info_collector(const smart_info_collector &)=delete
bool is_smartctl_available() const
std::string execute_command(const std::string &command) const
std::vector< disk_info > enumerate_disks()
smart_info_collector & operator=(smart_info_collector &&)=delete
smart_disk_metrics collect_smart_metrics(const disk_info &info)
Plugin interface for metric collectors.
Adapter for metric types to support interface definitions.
@ info
Informational, no action required.
bool smart_available
Whether SMART data might be available.
std::string device_path
Device path.
std::string device_type
Device type (e.g., ata, nvme, scsi)
Basic metric structure for interface compatibility.
uint64_t power_on_hours
Total power-on hours.
uint64_t power_cycle_count
Number of power cycles.
std::string firmware_version
Firmware version.
std::string model_name
Disk model name.
uint64_t uncorrectable_errors
Uncorrectable error count.
bool smart_supported
Whether SMART is supported.
double temperature_celsius
Current temperature in Celsius.
std::chrono::system_clock::time_point timestamp
uint64_t pending_sectors
Sectors pending reallocation.
uint64_t write_error_rate
Write error rate (raw value)
uint64_t read_error_rate
Read error rate (raw value)
std::string device_path
Device path (e.g., /dev/sda, /dev/disk0)
std::string serial_number
Disk serial number.
bool health_ok
Overall health status (PASSED = true)
uint64_t reallocated_sectors
Reallocated sector count.
bool smart_enabled
Whether SMART is enabled.