Documentation ¶
Index ¶
- Variables
- func ExecuteQueries(ctx context.Context, id int, r soap.RoundTripper, cache *Cache, ...)
- func InitMetrics(metrics []*Metric, perfmanager *mo.PerformanceManager)
- func ProcessMetric(cache *Cache, pem *types.PerfEntityMetric, timeStamp int64, replacepoint bool, ...)
- type Cache
- func (c *Cache) Add(vcenter, section, i string, v interface{})
- func (c *Cache) Clean(vcenter string, section string, refs []string)
- func (c *Cache) CleanAll(vcenter string, refs []string)
- func (c *Cache) FindHostAndCluster(vcenter, moref string) (string, string)
- func (c *Cache) FindMetricName(vcenter string, id int32) string
- func (c *Cache) FindName(vcenter, section, moref string) string
- func (c *Cache) FindNames(vcenter, section, moref string) []string
- func (c *Cache) FindString(vcenter, section, moref string) string
- func (c *Cache) FindTags(vcenter, moref string) []string
- func (c *Cache) GetConnectionState(vcenter, section, i string) *string
- func (c *Cache) GetDevices(vcenter, section, i string) *types.ArrayOfVirtualDevice
- func (c *Cache) GetDiskInfos(vcenter, section, i string) *[]types.GuestDiskInfo
- func (c *Cache) GetHostSystemConnectionState(vcenter, section, i string) *types.HostSystemConnectionState
- func (c *Cache) GetHostSystemPowerState(vcenter, section, i string) *types.HostSystemPowerState
- func (c *Cache) GetInt32(vcenter, section, i string) *int32
- func (c *Cache) GetMoref(vcenter, section, i string) *types.ManagedObjectReference
- func (c *Cache) GetMorefs(vcenter, section, i string) *[]types.ManagedObjectReference
- func (c *Cache) GetNetworkShapingInfo(vcenter, section, i string) *types.DVSTrafficShapingPolicy
- func (c *Cache) GetPowerState(vcenter, section, i string) *string
- func (c *Cache) GetString(vcenter, section, i string) *string
- func (c *Cache) GetStrings(vcenter, section, i string) *[]string
- func (c *Cache) GetTags(vcenter, section, i string) *[]types.Tag
- func (c *Cache) GetVirtualMachineConnectionState(vcenter, section, i string) *types.VirtualMachineConnectionState
- func (c *Cache) GetVirtualMachinePowerState(vcenter, section, i string) *types.VirtualMachinePowerState
- func (c *Cache) LookupMorefs(vcenter, section string) *map[string]*[]types.ManagedObjectReference
- func (c *Cache) LookupString(vcenter, section string) *map[string]*string
- func (c *Cache) Purge(vcenter, section string)
- type Metric
- type MetricDef
- type MetricGroup
- type VCenter
- func (vcenter *VCenter) AddMetric(metric MetricDef, mtype string)
- func (vcenter *VCenter) Connect() (*govmomi.Client, error)
- func (vcenter *VCenter) Init(metrics []*Metric)
- func (vcenter *VCenter) Query(interval int, domain string, replacepoint bool, properties []string, ...)
- func (vcenter *VCenter) ToString() string
Constants ¶
This section is empty.
Variables ¶
var MetricProperties = []string{"numcpu", "memorysizemb", "disks", "shaping_input", "shaping_output"}
MetricProperties are properties that are sent as metrics
var Properties = map[string]map[string][]string{
"datastore": {
"Datastore": {"name"},
"VirtualMachine": {"datastore"},
},
"urls": {
"Datastore": {"summary.url"},
},
"host": {
"HostSystem": {"name", "parent"},
"VirtualMachine": {"name", "runtime.host"},
},
"cluster": {
"ClusterComputeResource": {"name"},
},
"network": {
"DistributedVirtualPortgroup": {"name", "config.defaultPortConfig.inShapingPolicy", "config.defaultPortConfig.outShapingPolicy"},
"Network": {"name"},
"VirtualMachine": {"network", "config.hardware.device"},
},
"resourcepool": {
"ResourcePool": {"name", "parent", "vm"},
},
"folder": {
"Folder": {"name", "parent"},
"VirtualMachine": {"parent"},
},
"tags": {
"VirtualMachine": {"tag"},
"HostSystem": {"tag"},
},
"numcpu": {
"VirtualMachine": {"summary.config.numCpu"},
},
"memorysizemb": {
"VirtualMachine": {"summary.config.memorySizeMB"},
},
"disks": {
"VirtualMachine": {"guest.disk"},
},
}
Properties describes know relation to properties to related objects and properties
var PropertiesSections = map[string]string{
"summary.url": "urls",
"name": "names",
"datastore": "datastores",
"network": "networks",
"runtime.host": "hosts",
"parent": "parents",
"vm": "vms",
"tag": "tags",
"summary.config.numCpu": "cpus",
"summary.config.memorySizeMB": "memories",
"guest.disk": "disks",
"runtime.connectionState": "connections",
"runtime.powerState": "powers",
"config.defaultPortConfig.inShapingPolicy": "shaping_inputs",
"config.defaultPortConfig.outShapingPolicy": "shaping_outputs",
"config.hardware.device": "devices",
}
PropertiesSections represent the mapping of attributes to sections in the cache
Functions ¶
func ExecuteQueries ¶
func ExecuteQueries(ctx context.Context, id int, r soap.RoundTripper, cache *Cache, queryperf *types.QueryPerf, timeStamp int64, replacepoint bool, domain string, vcName string, channel *chan backend.Point, wg *sync.WaitGroup)
ExecuteQueries : Query a vcenter for performances
func InitMetrics ¶
func InitMetrics(metrics []*Metric, perfmanager *mo.PerformanceManager)
InitMetrics : maps metric keys to requested metrics
Types ¶
type Cache ¶
type Cache map[string]interface{}
Cache will hold some information's in memory
func (*Cache) CleanAll ¶
CleanAll cleans all sections of unknown references poolpaths and metrics are ignored as they will be cleaned real time
func (*Cache) FindHostAndCluster ¶
FindHostAndCluster finds host and cluster of a host or a vm
func (*Cache) FindMetricName ¶
FindMetricName find metricname from cache
func (*Cache) FindString ¶
FindString finds and return a string
func (*Cache) GetConnectionState ¶
GetConnectionState gets the connection state of a host or a virtual machine
func (*Cache) GetDevices ¶
func (c *Cache) GetDevices(vcenter, section, i string) *types.ArrayOfVirtualDevice
GetDevices gets the devices from a VM
func (*Cache) GetDiskInfos ¶
func (c *Cache) GetDiskInfos(vcenter, section, i string) *[]types.GuestDiskInfo
GetDiskInfos gets an array of diskinfos from cache
func (*Cache) GetHostSystemConnectionState ¶
func (c *Cache) GetHostSystemConnectionState(vcenter, section, i string) *types.HostSystemConnectionState
GetHostSystemConnectionState gets a host system connection state from cache
func (*Cache) GetHostSystemPowerState ¶
func (c *Cache) GetHostSystemPowerState(vcenter, section, i string) *types.HostSystemPowerState
GetHostSystemPowerState gets a host system power state from cache
func (*Cache) GetMoref ¶
func (c *Cache) GetMoref(vcenter, section, i string) *types.ManagedObjectReference
GetMoref gets a managed object reference from cache
func (*Cache) GetMorefs ¶
func (c *Cache) GetMorefs(vcenter, section, i string) *[]types.ManagedObjectReference
GetMorefs gets an array of managed references from cache
func (*Cache) GetNetworkShapingInfo ¶
func (c *Cache) GetNetworkShapingInfo(vcenter, section, i string) *types.DVSTrafficShapingPolicy
GetNetworkShapingInfo gets the shaping data from a DistributedVirtualPortGroup
func (*Cache) GetPowerState ¶
GetPowerState gets the power state of a host or a virtual machine
func (*Cache) GetStrings ¶
GetStrings gets an array of strings from cache
func (*Cache) GetVirtualMachineConnectionState ¶
func (c *Cache) GetVirtualMachineConnectionState(vcenter, section, i string) *types.VirtualMachineConnectionState
GetVirtualMachineConnectionState gets a virtual machine connection state from cache
func (*Cache) GetVirtualMachinePowerState ¶
func (c *Cache) GetVirtualMachinePowerState(vcenter, section, i string) *types.VirtualMachinePowerState
GetVirtualMachinePowerState gets a virtual machine power state from cache
func (*Cache) LookupMorefs ¶
func (c *Cache) LookupMorefs(vcenter, section string) *map[string]*[]types.ManagedObjectReference
LookupMorefs looks for items in the cache of type Morefs
func (*Cache) LookupString ¶
LookupString looks for items in the cache of type string
type MetricGroup ¶
type MetricGroup struct { ObjectType string Metrics []*MetricDef Mor []*types.ManagedObjectReference }
MetricGroup Grouping for retrieval
type VCenter ¶
type VCenter struct { Hostname string Username string Password string MetricGroups []*MetricGroup }
VCenter description