22#include <unordered_map>
61 default:
return "UNKNOWN";
119 auto name() const -> std::string_view
override {
return "vm_collector"; }
120 auto collect() -> std::vector<metric>
override;
135 bool initialize(const std::unordered_map<std::
string, std::
string>& config) override;
158 const std::unordered_map<std::string, std::string>& tags = {},
159 const std::string& unit =
"")
const;
Pure virtual interface for metric collector plugins.
Virtualization metrics monitoring collector.
std::unique_ptr< vm_info_collector > collector_
auto collect() -> std::vector< metric > override
Collect current metrics from this plugin.
std::chrono::milliseconds collection_interval_
vm_collector(const vm_collector &)=delete
bool initialize(const std::unordered_map< std::string, std::string > &config) override
auto get_metric_types() const -> std::vector< std::string > override
Get supported metric types.
std::unordered_map< std::string, double > get_statistics() const override
auto is_available() const -> bool override
Check if this plugin is available on the current system.
vm_collector(vm_collector &&)=delete
std::atomic< size_t > collection_count_
std::atomic< size_t > collection_errors_
vm_collector & operator=(vm_collector &&)=delete
vm_collector & operator=(const vm_collector &)=delete
metric create_metric(const std::string &name, double value, const std::unordered_map< std::string, std::string > &tags={}, const std::string &unit="") const
auto name() const -> std::string_view override
Get the unique name of this plugin.
auto interval() const -> std::chrono::milliseconds override
Get the collection interval for this plugin.
Platform-specific virtualization data collector implementation.
void detect_vm_environment()
vm_metrics collect_metrics()
vm_metrics cached_metrics_
Plugin interface for metric collectors.
Adapter for metric types to support interface definitions.
@ none
Not in a cgroup or not Linux.
vm_type
Detected virtualization platform.
@ docker
Docker Container (if distinguishable)
@ none
Bare metal (or undetected)
@ virtualbox
Oracle VirtualBox.
@ other
Other detected virtualization.
@ hyperv
Microsoft Hyper-V.
std::string vm_type_to_string(vm_type type)
Convert vm_type to string representation.
Basic metric structure for interface compatibility.
Virtualization specific metrics.
bool is_virtualized
True if running in a VM.
double guest_cpu_steal_time
% CPU time stolen by hypervisor (if available)
std::string hypervisor_vendor
Vendor string (e.g., "KVMKVMKVM" or "Microsoft Hv")
vm_type type
Detected hypervisor type.