Documentation ¶
Index ¶
- type CPUMetrics
- type CPUUsage
- type DiskUsage
- type HostCPU
- type HostMemory
- type HostMetricsInfo
- type HostMetricsProvider
- type MemoryMetrics
- type MetricsProvider
- type Network
- type NetworkUsage
- type VMCollector
- func (vmc *VMCollector) Start()
- func (vmc *VMCollector) Stop()
- func (vmc *VMCollector) Subscribe(op trace.Operation, moref types.ManagedObjectReference, id string) (chan interface{}, error)
- func (vmc *VMCollector) Unsubscribe(op trace.Operation, moref types.ManagedObjectReference, ch chan interface{})
- type VMMetrics
- type VirtualDisk
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPUMetrics ¶
type CPUMetrics struct { // CPUs are the individual CPU metrics CPUs []CPUUsage // Usage is the percentage of total vm CPU usage Usage float32 }
CPUMetrics encapsulates available vm CPU metrics
type CPUUsage ¶
type CPUUsage struct { // processor id (0,1,2) ID int // MhzUsage is the MhZ consumed by a specific processor MhzUsage int64 }
CPUUsage provides individual CPU metrics
type DiskUsage ¶
type DiskUsage struct { Bytes uint64 // total bytes for interval Kbps int64 // KiloBytesPerSecond for interval Op uint64 // Operation count for interval Ops int64 // Operations per second }
DiskUsage provides detailed disk stats
type HostCPU ¶
type HostCPU struct {
UsagePercent float64
}
HostCPU stores an ESXi host's CPU metrics.
type HostMemory ¶
HostMemory stores an ESXi host's memory metrics.
type HostMetricsInfo ¶
type HostMetricsInfo struct { Memory HostMemory CPU HostCPU }
HostMetricsInfo stores an ESXi host's memory and CPU metrics.
type HostMetricsProvider ¶
HostMetricsProvider returns CPU and memory metrics for all ESXi hosts in a cluster via implementation of the MetricsProvider interface.
func NewHostMetricsProvider ¶
func NewHostMetricsProvider(c *vim25.Client) *HostMetricsProvider
NewHostMetricsProvider returns a new instance of HostMetricsProvider.
func (*HostMetricsProvider) GetMetricsForComputeResource ¶
func (h *HostMetricsProvider) GetMetricsForComputeResource(op trace.Operation, cr *object.ComputeResource) (map[string]*HostMetricsInfo, error)
GetMetricsForComputeResource gathers host metrics from the supplied compute resource. Returned map is keyed on the host ManagedObjectReference in string form.
func (*HostMetricsProvider) GetMetricsForHosts ¶
func (h *HostMetricsProvider) GetMetricsForHosts(op trace.Operation, hosts []*object.HostSystem) (map[string]*HostMetricsInfo, error)
GetMetricsForHosts returns metrics pertaining to supplied ESX hosts. Returned map is keyed on the host ManagedObjectReference in string form.
type MemoryMetrics ¶
type MemoryMetrics struct { // Consumed memory of vm in bytes Consumed int64 // Active memory of vm in bytes Active int64 // Provisioned memory of vm in bytes Provisioned int64 }
MemoryMetrics encapsulates available vm memory metrics
type MetricsProvider ¶
type MetricsProvider interface { // GetMetricsForComputeResource returns metrics for a particular compute resource. The metrics are // returned in a map of HostMetricsInfo keyed on host ManagedObjectReferences. GetMetricsForComputeResource(trace.Operation, *object.ComputeResource) (map[string]*HostMetricsInfo, error) // GetMetricsForHosts returns metrics pertaining to supplied ESX hosts. GetMetricsForHosts(trace.Operation, []*object.HostSystem) (map[string]*HostMetricsInfo, error) }
MetricsProvider defines the interface for providing metrics.
type Network ¶
type Network struct { Name string Rx NetworkUsage Tx NetworkUsage }
Network provides metrics for individual network devices
type NetworkUsage ¶
type NetworkUsage struct { Bytes uint64 // total bytes Kbps int64 // KiloBytesPerSecond Packets int64 // total packet count Errors int64 // NOT CURRENTLY IMPLEMENTED Dropped int64 // total dropped packet count }
NetworkUsage provides detailed network stats
type VMCollector ¶
type VMCollector struct {
// contains filtered or unexported fields
}
VMCollector is the VM metrics collector
func NewVMCollector ¶
func NewVMCollector(session *session.Session) *VMCollector
newVMCollector will instantiate a new collector responsible for gathering VM metrics
func (*VMCollector) Start ¶
func (vmc *VMCollector) Start()
Start will begin the collection polling process
func (*VMCollector) Stop ¶
func (vmc *VMCollector) Stop()
Stop will stop the collection polling process
func (*VMCollector) Subscribe ¶
func (vmc *VMCollector) Subscribe(op trace.Operation, moref types.ManagedObjectReference, id string) (chan interface{}, error)
Subscribe to a vm metric subscription
func (*VMCollector) Unsubscribe ¶
func (vmc *VMCollector) Unsubscribe(op trace.Operation, moref types.ManagedObjectReference, ch chan interface{})
Unsubscribe from a vm metric subscription. The subscriber channel will be evicted and when no subscribers remain the subscription will be removed.
type VMMetrics ¶
type VMMetrics struct { CPU CPUMetrics Memory MemoryMetrics Networks []Network Disks []VirtualDisk SampleTime time.Time // interval of collection in seconds Interval int32 }
VMMetrics encapsulates the available metrics
type VirtualDisk ¶
VirtualDisk provides metrics for individual disks