vsphere

package
v0.30.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package vsphere provides various wrapper functions and types for interacting with and monitoring VMware vSphere environments.

Index

Constants

View Source
const (
	MgObjRefTypeFolder          string = "Folder"
	MgObjRefTypeDatacenter      string = "Datacenter"
	MgObjRefTypeComputeResource string = "ComputeResource"
	MgObjRefTypeResourcePool    string = "ResourcePool"
	MgObjRefTypeHostSystem      string = "HostSystem"
	MgObjRefTypeVirtualMachine  string = "VirtualMachine"
	MgObjRefTypeVirtualApp      string = "VirtualApp"
)

Managed Object Reference types

View Source
const (

	// https://stackoverflow.com/questions/34124294/writing-powers-of-10-as-constants-compactly
	// untyped float
	Hz  = 1
	KHz = 1e3
	MHz = 1e6
	GHz = 1e9
	THz = 1e12
	PHz = 1e15
	EHz = 1e18
	ZHz = 1e21
	YHz = 1e24
)

CPU speed values

View Source
const CustomAttributeValNotSet string = "NotSet"

CustomAttributeValNotSet is used to indicate that a Custom Attribute value was not set on an object.

View Source
const ParentResourcePool string = "Resources"

ParentResourcePool represents the hidden resource pool named Resources which is present on virtual machine hosts. This resource pool is a parent of all resource pools of the host. Including this pool in "eligible" resource pool lists throws off calculations (e.g., causes a VM to show up twice).

Variables

View Source
var ErrAlarmNotExcludedFromEvaluation = errors.New("alarm detected and not excluded from evaluation")

ErrAlarmNotExcludedFromEvaluation indicates that one or more alarms were detected and not excluded from evaluation.

View Source
var ErrAvailableFieldValueNotDefined = errors.New("no custom attributes defined within vSphere environment for this type")

ErrAvailableFieldValueNotDefined is returned when no Custom Attributes are defined within an inventory for an associated managed object type.

View Source
var ErrAvailableFieldValueNotFound = errors.New("failed to find a matching available field name")

ErrAvailableFieldValueNotFound is returned when a specified Custom Attribute name cannot be located within an inventory. This might be the case if a specified Custom Attribute name has a typo.

View Source
var ErrConvertBaseCustomFieldValue = errors.New("failed to convert base custom field value to obtain key/value pair")

ErrConvertBaseCustomFieldValue is returned when a conversion error occurs or (type assertion failure) for a provided BaseCustomFieldValue.

TODO: Document how/when this might occur.

View Source
var ErrCustomAttributeKeyNotFound = errors.New("failed to find a matching custom attribute key/value pair for provided custom attribute key")

ErrCustomAttributeKeyNotFound is returned when a Custom Attribute key (and thus the desired value) cannot be found for a vSphere object. This can occur when a Custom Attribute exists within an inventory, but is not applied to a specific managed object.

View Source
var ErrCustomAttributeNotSet = errors.New("custom attributes not set")

ErrCustomAttributeNotSet is similar to ErrCustomAttributeKeyNotFound, but is returned when there are no Custom Attributes set for an associated managed object type.

View Source
var ErrDatacenterNotFound = errors.New("specified Datacenters not found")

ErrDatacenterNotFound indicates that one or more specified datacenters were not located.

View Source
var ErrDatastoreInaccessible = errors.New("datastore is inaccessible")

ErrDatastoreInaccessible indicates that a specified datastore is marked as inaccessible.

View Source
var ErrDatastoreIormConfigurationPropertyUnavailable = errors.New(
	"datastore storage I/O resource management configuration property unavailable",
)

ErrDatastoreIormConfigurationPropertyUnavailable indicates that the IORMConfigInfo property is not available for evaluation. Without this property, plugins in this project are unable to reliably determine whether datastore performance statistics are being gathered.

https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.StorageResourceManager.IORMConfigInfo.html

View Source
var ErrDatastoreIormConfigurationStatisticsCollectionDisabled = errors.New(
	"datastore storage I/O statistics collection disabled",
)

ErrDatastoreIormConfigurationStatisticsCollectionDisabled indicates that I/O (Iops, Latency) statistics collection is disabled. The administrators of the vSphere environment must enable the Statistics Collection option for each datastore that is monitored by plugins in this project.

https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.StorageResourceManager.IORMConfigInfo.html

View Source
var ErrDatastoreLatencyAllMetricSetsZero = errors.New("datastore latency metric sets are all value zero")

ErrDatastoreLatencyAllMetricSetsZero indicates that all performance metric metric sets for a specified datastore are of value 0.

View Source
var ErrDatastoreLatencyThresholdCrossed = errors.New("datastore latency exceeds specified threshold")

ErrDatastoreLatencyThresholdCrossed indicates that a specified datastore has exceeded a given latency threshold.

View Source
var ErrDatastorePerformanceMetricsMissing = errors.New("datastore performance metrics results are unavailable")

ErrDatastorePerformanceMetricsMissing indicates that no datastore performance metrics are available.

This is believed to occur when a datastore is newly created and metrics have not yet been collected. For a long-lived datastore this is a problematic scenario, but for a new datastore it is not unexpected.

View Source
var ErrDatastorePerformancePercentileUnavailable = errors.New(
	"datastore performance percentile unavailable",
)

ErrDatastorePerformancePercentileUnavailable is returned when a specific performance percentile is requested, but is unavailable in the results returned from Datastore Performance Summary query.

View Source
var ErrDatastoreSpaceUsageThresholdCrossed = errors.New("datastore usage exceeds specified threshold")

ErrDatastoreSpaceUsageThresholdCrossed indicates that a specified datastore has exceeded a given threshold.

View Source
var ErrDatastoreStatsCollectionPropertyUnavailable = errors.New(
	"datastore storage I/O statistics collection property unavailable",
)

ErrDatastoreStatsCollectionPropertyUnavailable indicates that the statsCollectionEnabled property is not available for evaluation. Without access to this property, plugins in this project are unable to reliably determine whether datastore performance statistics are being gathered.

https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.StorageResourceManager.IORMConfigInfo.html

View Source
var ErrEntityStateReloadUnsuccessful = errors.New("entity state reload unsuccessful")

ErrEntityStateReloadUnsuccessful indicates that an attempt to trigger a state reload for one or more entity values was unsuccessful.

View Source
var ErrHostDatastorePairingFailed = errors.New("failed to compile host/datastore pairings")

ErrHostDatastorePairingFailed is returned when compiling host and datastore pairings using provided the Custom Attribute fails. This is usually due to a lack of a match between Custom Attribute values used on hosts and datastores.

For example, this may occur if prefix matching is not enabled and the host Custom Attribute uses a Location attribute which contains a separator between a datacenter and the hosts rack position, whereas a datastore contains only the datacenter.

View Source
var ErrHostSystemCPUUsageThresholdCrossed = errors.New("host CPU usage exceeds specified threshold")

ErrHostSystemCPUUsageThresholdCrossed indicates that specified host CPU usage has exceeded a given threshold

View Source
var ErrHostSystemHardwarePropertiesUnavailable = errors.New("host hardware properties unavailable")

ErrHostSystemHardwarePropertiesUnavailable indicates that specified host hardware properties are unavailable. This is likely due to permission issues for the service account or a shallow host properties retrieval request (coding error).

View Source
var ErrHostSystemMemoryUsageThresholdCrossed = errors.New("host memory usage exceeds specified threshold")

ErrHostSystemMemoryUsageThresholdCrossed indicates that specified host memory usage has exceeded a given threshold

View Source
var ErrManagedObjectIDIsEmpty = errors.New("managed object ID is empty")

ErrManagedObjectIDIsEmpty indicates that a managed object ID is empty.

View Source
var ErrManagedObjectIDIsNil = errors.New("managed object ID is nil")

ErrManagedObjectIDIsNil indicates that a managed object ID is unset, which may occur if the property is not requested from the vSphere API or if the service account executing the plugin has insufficient privileges.

View Source
var ErrResourcePoolMemoryUsageThresholdCrossed = errors.New("memory usage exceeds specified threshold")

ErrResourcePoolMemoryUsageThresholdCrossed indicates that specified resource pools have exceeded a given threshold

View Source
var ErrResourcePoolStatisticUnavailable = errors.New("resource pool missing expected statistic")

ErrResourcePoolStatisticUnavailable indicates that one or more statistics are missing from specified Resource Pools. This is usually due to retrieving an insufficient subset of properties from a vSphere View.

View Source
var ErrRuntimeTimeoutReached = errors.New("plugin runtime exceeded specified timeout value")

ErrRuntimeTimeoutReached indicates that plugin runtime exceeded specified timeout value.

View Source
var ErrSnapshotAgeThresholdCrossed = errors.New("snapshot exceeds specified age threshold")

ErrSnapshotAgeThresholdCrossed indicates that a snapshot is older than a specified age threshold

View Source
var ErrSnapshotCountThresholdCrossed = errors.New("snapshots exceed specified count threshold")

ErrSnapshotCountThresholdCrossed indicates that a snapshot set for a single VM has exceeded a specified count threshold.

View Source
var ErrSnapshotSizeThresholdCrossed = errors.New("snapshot exceeds specified size threshold")

ErrSnapshotSizeThresholdCrossed indicates that a snapshot is larger than a specified size threshold

View Source
var ErrVCPUsUsageThresholdCrossed = errors.New("vCPUS allocation exceeds specified threshold")

ErrVCPUsUsageThresholdCrossed indicates that specified vCPUs allocation has exceeded a given threshold

View Source
var ErrVMDatastoreNotInVMHostPairedList = errors.New("host/datastore/vm mismatch")

ErrVMDatastoreNotInVMHostPairedList is returned when one or more datastores for a VirtualMachine are not in the list of datastores paired with the VirtualMachine's current host.

View Source
var ErrVMwareAdminAssistanceNeeded = errors.New(
	"assistance needed from vmware administrators to resolve issue",
)

ErrVMwareAdminAssistanceNeeded indicates that a known/detected problem can only be resolved with the assistance of the administrators of the VMware environment(s) monitored by plugins in this project. While this team may be the same ones to receive the notifications from the monitoring system using this project's plugin, that may not always be the case.

View Source
var ErrVirtualHardwareOutdatedVersionsFound = errors.New("outdated hardware versions found")

ErrVirtualHardwareOutdatedVersionsFound indicates that hardware versions older than the minimum have been found.

View Source
var ErrVirtualMachineBackupDateOld = errors.New(
	"virtual machine backup date exceeds specified threshold",
)

ErrVirtualMachineBackupDateOld indicates that a Virtual Machine has a backup date specified, but the backup is older than the user specified threshold.

View Source
var ErrVirtualMachineDiskConsolidationNeeded = errors.New("disk consolidation needed")

ErrVirtualMachineDiskConsolidationNeeded indicates that disk consolidation is needed for one or more Virtual Machines.

View Source
var ErrVirtualMachineInteractiveResponseNeeded = errors.New("interactive response needed")

ErrVirtualMachineInteractiveResponseNeeded indicates that an interactive response is needed for one or more Virtual Machines.

View Source
var ErrVirtualMachineMissingBackupDate = errors.New(
	"virtual machine missing backup date",
)

ErrVirtualMachineMissingBackupDate indicates that a Virtual Machine is missing an expected backup date (or value).

View Source
var ErrVirtualMachinePowerCycleUptimeThresholdCrossed = errors.New("power cycle uptime exceeds specified threshold")

ErrVirtualMachinePowerCycleUptimeThresholdCrossed indicates that specified Virtual Machine power cycle thresholds have been exceeded.

Functions

func AlarmsOneLineCheckSummary added in v0.16.0

func AlarmsOneLineCheckSummary(
	stateLabel string,
	triggeredAlarms TriggeredAlarms,
	datacentersEvaluated []string,
) string

AlarmsOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func AlarmsReport added in v0.16.0

func AlarmsReport(
	c *vim25.Client,
	triggeredAlarms TriggeredAlarms,
	triggeredAlarmFilters TriggeredAlarmFilters,
	specifiedDatacenters []string,
	datacentersEvaluated []string,
) string

AlarmsReport generates a summary of detected alarms along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func AnnotateError added in v0.25.0

func AnnotateError(err error) error

AnnotateError is a helper function used to add additional human-readable explanation for errors commonly emitted by dependencies. This function receives an error, evaluates whether it contains specific errors in its chain and then (potentially) appends additional details for later use. This updated error chain is returned to the caller, preserving the original wrapped error. The original error is returned unmodified if no annotations were deemed necessary.

func CustomAttrKeyToValue added in v0.2.0

func CustomAttrKeyToValue(caKey int32, customValue []types.BaseCustomFieldValue) (string, error)

CustomAttrKeyToValue receives the key of a Custom Attribute key/value pair as a slice of BaseCustomFieldValue which represents the Custom Attribute values for vSphere objects (e.g., HostSystem, Datastore). An error is returned if conversion fails or if the specified Custom Attribute key is not found.

func CustomAttrNameToKey added in v0.2.0

func CustomAttrNameToKey(caName string, availableField []types.CustomFieldDef) (int32, error)

CustomAttrNameToKey receives a user-provided Custom Attribute name and a slice of values which contain key/value fields. If a match for the user-provided Custom Attribute name is found, the matching key is returned. This key can be used to search for a match in the Custom Values associated with vSphere objects (e.g., Hosts, Datastores). An error is returned if a match is not found.

func DatastoreIDsToNames added in v0.2.0

func DatastoreIDsToNames(dsRefs []types.ManagedObjectReference, dss []mo.Datastore) []string

DatastoreIDsToNames returns a list of matching Datastore names for the provided list of Managed Object References for Datastores.

func DatastorePerformanceOneLineCheckSummary added in v0.27.0

func DatastorePerformanceOneLineCheckSummary(
	stateLabel string,
	dsPerfSet DatastorePerformanceSet,
) string

DatastorePerformanceOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func DatastorePerformanceReport added in v0.27.0

func DatastorePerformanceReport(
	c *vim25.Client,
	dsPerfSet DatastorePerformanceSet,
	hideHistoricalMetricSets bool,
) string

DatastorePerformanceReport generates a summary of Datastore usage along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func DatastoreSpaceUsageOneLineCheckSummary added in v0.28.0

func DatastoreSpaceUsageOneLineCheckSummary(
	stateLabel string,
	dsUsageSummary DatastoreSpaceUsageSummary,
) string

DatastoreSpaceUsageOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func DatastoreSpaceUsageReport added in v0.28.0

func DatastoreSpaceUsageReport(
	c *vim25.Client,
	dsUsageSummary DatastoreSpaceUsageSummary,
) string

DatastoreSpaceUsageReport generates a summary of Datastore usage along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func DaysAgo added in v0.29.0

func DaysAgo(event time.Time) int

DaysAgo accepts an event date and returns the number of days ago that it occurred. Only full days are counted. If the event has not occurred yet, 0 is returned.

func DisableLogging added in v0.5.1

func DisableLogging()

DisableLogging reapplies default package-level logging settings of muting all logging output.

func EnableLogging added in v0.5.1

func EnableLogging()

EnableLogging enables logging output from this package. Output is muted by default unless explicitly requested (by calling this function).

func EntityStatusToNagiosState added in v0.16.0

func EntityStatusToNagiosState(entityStatus types.ManagedEntityStatus) (string, int)

EntityStatusToNagiosState converts a vSphere Managed Entity Status (e.g., "red", "yellow") to a Nagios state label and exit code.

func ExceedsAge added in v0.4.0

func ExceedsAge(event time.Time, days int) bool

ExceedsAge indicates whether a given event date is older than the specified number of days.

func ExceedsSize added in v0.5.0

func ExceedsSize(snapshotSize int64, thresholdSize int64) bool

ExceedsSize indicates whether a given snapshot size is greater than the specified value in GB.

func ExcludeVMsByName

func ExcludeVMsByName(allVMs []mo.VirtualMachine, ignoreList []string) ([]mo.VirtualMachine, int)

ExcludeVMsByName receives a collection of VirtualMachines and a list of VMs that should be ignored. A new collection minus ignored VirtualMachines is returned along with the number of VMs that were excluded.

If the collection of VirtualMachine is empty, an empty collection is returned. If the list of ignored VirtualMachines is empty, the same items from the received collection of VirtualMachines is returned. If the list of ignored VirtualMachines is greater than the list of received VirtualMachines, then only matching VirtualMachines will be excluded and any others silently skipped.

func FilterDatastoresByID added in v0.21.0

func FilterDatastoresByID(dss []mo.Datastore, dsID string) (mo.Datastore, int, error)

FilterDatastoresByID receives a collection of Datastores and a Datastore ID to filter against. An error is returned if the list of Datastores is empty or if a match was not found. The matching Datastore is returned along with the number of Datastores that were excluded.

func FilterDatastoresByIDs added in v0.29.2

func FilterDatastoresByIDs(dss []mo.Datastore, dsIDs ...string) ([]mo.Datastore, int, error)

FilterDatastoresByIDs receives a collection of Datastores and Datastore IDs to filter against. An error is returned if either list is empty or if a match was not found for one of the provided IDs. The matching Datastores are returned along with the number of Datastores that were excluded.

func FilterDatastoresByName added in v0.21.0

func FilterDatastoresByName(dss []mo.Datastore, dsName string) (mo.Datastore, int, error)

FilterDatastoresByName accepts a collection of Datastores and a Datastore name to filter against. An error is returned if the list of Datastores is empty or if a match was not found. The matching Datastore is returned along with the number of Datastores that were excluded.

func FilterHostSystemsByID added in v0.21.0

func FilterHostSystemsByID(hss []mo.HostSystem, hsID string) (mo.HostSystem, int, error)

FilterHostSystemsByID receives a collection of HostSystems and a HostSystem ID to filter against. An error is returned if the list of HostSystems is empty or if a match was not found. The matching HostSystem is returned along with the number of HostSystems that were excluded.

func FilterHostSystemsByName added in v0.21.0

func FilterHostSystemsByName(hss []mo.HostSystem, hsName string) (mo.HostSystem, int, error)

FilterHostSystemsByName accepts a collection of HostSystems and a HostSystem name to filter against. An error is returned if the list of HostSystems is empty or if a match was not found. The matching HostSystem is returned along with the number of HostSystems that were excluded.

func FilterNetworksByID added in v0.21.0

func FilterNetworksByID(nets []mo.Network, netID string) (mo.Network, int, error)

FilterNetworksByID receives a collection of Networks and a Network ID to filter against. An error is returned if the list of Networks is empty or if a match was not found. The matching Network is returned along with the number of Networks that were excluded.

func FilterNetworksByName added in v0.21.0

func FilterNetworksByName(nets []mo.Network, netName string) (mo.Network, int, error)

FilterNetworksByName accepts a collection of Networks and a Network name to filter against. An error is returned if the list of Networks is empty or if a match was not found. The matching Network is returned along with the number of Networks that were excluded.

func FilterVMsByDiskConsolidationState added in v0.23.0

func FilterVMsByDiskConsolidationState(vms []mo.VirtualMachine) ([]mo.VirtualMachine, int)

FilterVMsByDiskConsolidationState accepts a collection of VirtualMachines and evaluates whether their ConsolidationNeeded flag is set. This function assumes that the caller has already initiated a "reload" of each VirtualMachine in order to retrieve the most current status of its ConsolidationNeeded field. If the collection of provided VirtualMachines is empty, an empty collection is returned. The collection is returned along with the number of VirtualMachines that were excluded.

func FilterVMsByID added in v0.21.0

func FilterVMsByID(vms []mo.VirtualMachine, vmID string) (mo.VirtualMachine, int, error)

FilterVMsByID receives a collection of VirtualMachines and a VirtualMachine ID to filter against. An error is returned if the list of VirtualMachines is empty or if a match was not found. The matching VirtualMachine is returned along with the number of VirtualMachines that were excluded.

func FilterVMsByInteractiveQuestionStatus added in v0.23.0

func FilterVMsByInteractiveQuestionStatus(vms []mo.VirtualMachine) ([]mo.VirtualMachine, int)

FilterVMsByInteractiveQuestionStatus accepts a collection of VirtualMachines and evaluates whether their Question flag is set. If the collection of provided VirtualMachines is empty, an empty collection is returned. The collection is returned along with the number of VirtualMachines that were excluded.

func FilterVMsByName added in v0.21.0

func FilterVMsByName(vms []mo.VirtualMachine, vmName string) (mo.VirtualMachine, int, error)

FilterVMsByName accepts a collection of VirtualMachines and a VirtualMachine name to filter against. An error is returned if the list of VirtualMachines is empty or if a match was not found. The matching VirtualMachine is returned along with the number of VirtualMachines that were excluded.

func FilterVMsByPowerCycleUptime added in v0.10.0

func FilterVMsByPowerCycleUptime(vms []mo.VirtualMachine, warningThreshold int, criticalThreshold int) ([]mo.VirtualMachine, int)

FilterVMsByPowerCycleUptime filters the provided collection of VirtualMachines to just those with WARNING or CRITICAL values based on provided thresholds. The collection is returned along with the number of VirtualMachines that were excluded.

func FilterVMsByPowerState

func FilterVMsByPowerState(vms []mo.VirtualMachine, includePoweredOff bool) ([]mo.VirtualMachine, int)

FilterVMsByPowerState accepts a collection of VirtualMachines and a boolean value to indicate whether powered off VMs should be included in the returned collection. If the collection of provided VirtualMachines is empty, an empty collection is returned. The collection is returned along with the number of VirtualMachines that were excluded.

func FilterVMsWithOldHardware

func FilterVMsWithOldHardware(vms []mo.VirtualMachine, hwIndex HardwareVersionsIndex) ([]mo.VirtualMachine, int)

FilterVMsWithOldHardware filters the provided collection of VirtualMachines to just those with older hardware versions. The collection is returned along with the number of VirtualMachines that were excluded.

func FilterVMsWithSnapshots added in v0.4.0

func FilterVMsWithSnapshots(vms []mo.VirtualMachine) ([]mo.VirtualMachine, int)

FilterVMsWithSnapshots filters the provided collection of VirtualMachines to just those with snapshots. Later steps are responsible for validating whether those snapshots place the VMs into non-OK states. The collection is returned along with the number of VirtualMachines that were excluded.

func FilterVMsWithToolsIssues

func FilterVMsWithToolsIssues(vms []mo.VirtualMachine, includePoweredOff bool) ([]mo.VirtualMachine, int)

FilterVMsWithToolsIssues filters the provided collection of VirtualMachines to just those with non-OK status, unless powered off VMs are also evaluated. In that case, ignore any powered off VirtualMachines with VMware Tools in a "not running" state which are otherwise current or unmanaged. The collection is returned along with the number of VirtualMachines that were excluded.

func FormattedTimeSinceEvent added in v0.29.0

func FormattedTimeSinceEvent(event time.Time) string

FormattedTimeSinceEvent receives a Time value and converts it to a string representing the largest useful whole units of time in days and hours. For example, if an event occurred 1 year, 2 days and 3 hours ago, this function will return the string '367d 3h ago', but if the event was 3 hours ago then '3h ago' will be returned. If the event occurs in the future, a suffix of 'until' is used in the formatted string.

func GetDatacenters added in v0.17.0

func GetDatacenters(ctx context.Context, c *vim25.Client, dcNames []string, propsSubset bool) ([]mo.Datacenter, error)

GetDatacenters receives a list of Datacenter names along with a boolean value indicating whether only a subset of properties for the Datacenters should be returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). If an empty list of Datacenter names is provided then all visible Datacenters will be retrieved. The list of Datacenters found is returned, or an error if one occurs.

func GetDatastoreByName

func GetDatastoreByName(ctx context.Context, c *vim25.Client, dsName string, datacenter string, propsSubset bool) (mo.Datastore, error)

GetDatastoreByName accepts the name of a datastore, the name of a datacenter and a boolean value indicating whether only a subset of properties for the Datastore should be returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). If the datacenter name is an empty string then the default datacenter will be used.

func GetDatastores

func GetDatastores(ctx context.Context, c *vim25.Client, propsSubset bool) ([]mo.Datastore, error)

GetDatastores accepts a context, a connected client and a boolean value indicating whether a subset of properties per Datastore are retrieved. A collection of Datastores with requested properties is returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow).

func GetEligibleRPs

func GetEligibleRPs(ctx context.Context, c *vim25.Client, includeRPs []string, excludeRPs []string, propsSubset bool) ([]mo.ResourcePool, error)

GetEligibleRPs receives a list of Resource Pool names that should either be explicitly included or excluded along with a boolean value indicating whether only a subset of properties for the Resource Pools should be returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). The filtered list of Resource Pools is returned, or an error if one occurs.

func GetHostSystemByName added in v0.2.0

func GetHostSystemByName(ctx context.Context, c *vim25.Client, hsName string, datacenter string, propsSubset bool) (mo.HostSystem, error)

GetHostSystemByName accepts the name of a HostSystem, the name of a datacenter and a boolean value indicating whether only a subset of properties for the HostSystem should be returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). If the datacenter name is an empty string then the default datacenter will be used.

func GetHostSystems added in v0.2.0

func GetHostSystems(ctx context.Context, c *vim25.Client, propsSubset bool) ([]mo.HostSystem, error)

GetHostSystems accepts a context, a connected client and a boolean value indicating whether a subset of properties per HostSystem are retrieved. A collection of HostSystems with requested properties is returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow).

func GetHostSystemsTotalMemory added in v0.7.0

func GetHostSystemsTotalMemory(ctx context.Context, c *vim25.Client, excludeOffline bool) (int64, error)

GetHostSystemsTotalMemory returns the total memory capacity for all HostSystems in bytes. Unless requested, offline or otherwise unavailable hosts are included for evaluation based on the assumption that offline hosts are offline for only a brief time and should still be considered part of overall cluster capacity.

func GetNetworkByName

func GetNetworkByName(ctx context.Context, c *vim25.Client, netName string, datacenter string, propsSubset bool) (mo.Network, error)

GetNetworkByName accepts the name of a network, the name of a datacenter and a boolean value indicating whether only a subset of properties for the Network should be returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). If the datacenter name is an empty string then the default datacenter will be used.

func GetNetworks

func GetNetworks(ctx context.Context, c *vim25.Client, propsSubset bool) ([]mo.Network, error)

GetNetworks accepts a context, a connected client and a boolean value indicating whether a subset of properties per Network are retrieved. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). A collection of Networks with requested properties is returned or nil and an error, if one occurs.

func GetObjectCAVal added in v0.2.0

func GetObjectCAVal(caName string, obj mo.ManagedEntity) (string, error)

GetObjectCAVal receives the name of a Custom Attribute and a ManagedEntity (an abstract base type for all managed objects present in the inventory tree) and returns the value for the specified Custom Attribute. An error is returned if the value could not be retrieved indicating the cause of the failure.

func GetRPByName added in v0.2.0

func GetRPByName(ctx context.Context, c *vim25.Client, rpName string, datacenter string, propsSubset bool) (mo.ResourcePool, error)

GetRPByName accepts the name of a Resource Pool, the name of a datacenter and a boolean value indicating whether only a subset of properties for the Network should be returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). If the datacenter name is an empty string then the default datacenter will be used.

func GetVMByName

func GetVMByName(ctx context.Context, c *vim25.Client, vmName string, datacenter string, propsSubset bool) (mo.VirtualMachine, error)

GetVMByName accepts the name of a VirtualMachine, the name of a datacenter and a boolean value indicating whether only a subset of properties for the VirtualMachine should be returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). If the datacenter name is an empty string then the default datacenter will be used.

func GetVMToolsStatusSummary

func GetVMToolsStatusSummary(vms []mo.VirtualMachine) nagios.ServiceState

GetVMToolsStatusSummary accepts a collection of VirtualMachines and checks the VMware Tools status for each one, providing an overall Nagios state label and exit code for the collection.

NOTE: This function does *NOT* differentiate between VirtualMachines that are powered on and those that are powered off. If only powered on VirtualMachines should be evaluated, the caller should perform this filtering first before passing the collection to this function.

func GetVMs

func GetVMs(ctx context.Context, c *vim25.Client, propsSubset bool) ([]mo.VirtualMachine, error)

GetVMs accepts a context, a connected client and a boolean value indicating whether a subset of properties per VirtualMachine are retrieved. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow) A collection of VirtualMachines with requested properties is returned or nil and an error, if one occurs.

func GetVMsFromContainer added in v0.8.0

func GetVMsFromContainer(ctx context.Context, c *vim25.Client, propsSubset bool, objs ...mo.ManagedEntity) ([]mo.VirtualMachine, error)

GetVMsFromContainer receives one or many ManagedEntity values for Folder, Datacenter, ComputeResource, ResourcePool, VirtualApp or HostSystem types and returns a list of VirtualMachine object references. Deduplication of VirtualMachines is applied in order to properly handle nested resource pools.

The propsSubset boolean value indicates whether a subset of properties per VirtualMachine are retrieved. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). A collection of VirtualMachines with requested properties is returned or nil and an error, if one occurs.

func GetVMsFromDatastore added in v0.3.0

func GetVMsFromDatastore(ctx context.Context, c *vim25.Client, ds mo.Datastore, propsSubset bool) ([]mo.VirtualMachine, error)

GetVMsFromDatastore receives a Datastore object reference and returns a list of VirtualMachine object references. The propsSubset boolean value indicates whether a subset of properties per VirtualMachine are retrieved. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow) A collection of VirtualMachines with requested properties is returned or nil and an error, if one occurs.

func H2D2VMsOneLineCheckSummary added in v0.2.0

func H2D2VMsOneLineCheckSummary(
	stateLabel string,
	evaluatedVMs []mo.VirtualMachine,
	vmDatastoresPairingIssues VMToMismatchedPairing,
	rps []mo.ResourcePool,
) string

H2D2VMsOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func H2D2VMsReport added in v0.2.0

func H2D2VMsReport(
	c *vim25.Client,
	h2dIdx HostToDatastoreIndex,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmDatastoresPairingIssues VMToMismatchedPairing,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
	ignoreMissingCA bool,
	ignoredDatastores []string,
	datastoreCAPrefixSeparator string,
	hostCAPrefixSeparator string,
	datastoreCAName string,
	hostCAName string,
) string

H2D2VMsReport generates a summary of host/datastore/vms pairings along with additional details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func HostSystemCPUUsageOneLineCheckSummary added in v0.9.0

func HostSystemCPUUsageOneLineCheckSummary(
	stateLabel string,
	hsVMs []mo.VirtualMachine,
	hsUsageSummary HostSystemCPUSummary,
) string

HostSystemCPUUsageOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func HostSystemCPUUsageReport added in v0.9.0

func HostSystemCPUUsageReport(
	c *vim25.Client,
	hsVMs []mo.VirtualMachine,
	hsUsageSummary HostSystemCPUSummary,
) string

HostSystemCPUUsageReport generates a summary of HostSystem CPU usage along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func HostSystemMemoryUsageOneLineCheckSummary added in v0.8.0

func HostSystemMemoryUsageOneLineCheckSummary(
	stateLabel string,
	hsVMs []mo.VirtualMachine,
	hsUsageSummary HostSystemMemorySummary,
) string

HostSystemMemoryUsageOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func HostSystemMemoryUsageReport added in v0.8.0

func HostSystemMemoryUsageReport(
	c *vim25.Client,
	hsVMs []mo.VirtualMachine,
	hsUsageSummary HostSystemMemorySummary,
) string

HostSystemMemoryUsageReport generates a summary of HostSystem memory usage along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func ListVMSnapshots added in v0.5.0

func ListVMSnapshots(vm mo.VirtualMachine, w io.Writer)

ListVMSnapshots generates a quick listing of all snapshots for a given VM and emits the results to the provided io.Writer.

func Login

func Login(
	ctx context.Context,
	server string,
	port int,
	trustCert bool,
	username string,
	domain string,
	password string,
	userAgent string,
) (*govmomi.Client, error)

Login receives credentials and related settings used to handle creating a new client and logging into a specified vSphere environment. The initialized and logged-in client is returned for further use.

func MemoryUsedPercentage added in v0.6.0

func MemoryUsedPercentage(
	aggregateMemoryUsageInBytes int64,
	maxMemoryUsageInBytes int64,
) float64

MemoryUsedPercentage is a helper function used to calculate the current memory usage as a percentage of the specified maximum memory allowed to be used.

func RPMemoryUsageOneLineCheckSummary added in v0.6.0

func RPMemoryUsageOneLineCheckSummary(
	stateLabel string,
	aggregateMemoryUsageInBytes int64,
	maxMemoryUsageInBytes int64,
	clusterMemoryInBytes int64,
	rps []mo.ResourcePool,
) string

RPMemoryUsageOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func ResourcePoolsMemoryReport added in v0.6.0

func ResourcePoolsMemoryReport(
	c *vim25.Client,
	maxMemoryUsageInBytes int64,
	clusterMemoryInBytes int64,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
	rpsVMs []mo.VirtualMachine,
) string

ResourcePoolsMemoryReport generates a summary of memory usage associated with specified Resource Pools along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func SnapshotsAgeOneLineCheckSummary added in v0.4.0

func SnapshotsAgeOneLineCheckSummary(
	stateLabel string,
	snapshotSets SnapshotSummarySets,
	snapshotThresholds SnapshotThresholds,
	evaluatedVMs []mo.VirtualMachine,
	rps []mo.ResourcePool,
) string

SnapshotsAgeOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func SnapshotsAgeReport added in v0.4.0

func SnapshotsAgeReport(
	c *vim25.Client,
	snapshotSummarySets SnapshotSummarySets,
	snapshotThresholds SnapshotThresholds,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsWithIssues []mo.VirtualMachine,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

SnapshotsAgeReport generates a summary of snapshot details along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func SnapshotsCountOneLineCheckSummary added in v0.7.0

func SnapshotsCountOneLineCheckSummary(
	stateLabel string,
	snapshotSets SnapshotSummarySets,
	snapshotThresholds SnapshotThresholds,
	evaluatedVMs []mo.VirtualMachine,
	rps []mo.ResourcePool,
) string

SnapshotsCountOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func SnapshotsCountReport added in v0.7.0

func SnapshotsCountReport(
	c *vim25.Client,
	snapshotSummarySets SnapshotSummarySets,
	snapshotThresholds SnapshotThresholds,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsWithIssues []mo.VirtualMachine,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

SnapshotsCountReport generates a summary of snapshot details along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func SnapshotsSizeOneLineCheckSummary added in v0.5.0

func SnapshotsSizeOneLineCheckSummary(
	stateLabel string,
	snapshotSets SnapshotSummarySets,
	snapshotThresholds SnapshotThresholds,
	evaluatedVMs []mo.VirtualMachine,
	rps []mo.ResourcePool,
) string

SnapshotsSizeOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func SnapshotsSizeReport added in v0.5.0

func SnapshotsSizeReport(
	c *vim25.Client,
	snapshotSummarySets SnapshotSummarySets,
	snapshotThresholds SnapshotThresholds,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsWithIssues []mo.VirtualMachine,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

SnapshotsSizeReport generates a summary of snapshot details along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func TriggerEntityStateReload added in v0.23.0

func TriggerEntityStateReload(ctx context.Context, c *vim25.Client, entities ...mo.ManagedEntity) error

TriggerEntityStateReload accepts a context, a client and a collection of ManagedEntity values whose state should be reloaded. This function is used when we need to ensure that we are working with the very latest state data for a vSphere object.

func VMBackupViaCAOneLineCheckSummary added in v0.29.0

func VMBackupViaCAOneLineCheckSummary(
	stateLabel string,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsWithBackups VMsWithBackup,
	rps []mo.ResourcePool,
) string

VMBackupViaCAOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func VMBackupViaCAReport added in v0.29.0

func VMBackupViaCAReport(
	c *vim25.Client,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsWithBackup VMsWithBackup,
	vmsToExclude []string,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

VMBackupViaCAReport generates a summary of VMs & their backup status along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func VMDiskConsolidationOneLineCheckSummary added in v0.14.0

func VMDiskConsolidationOneLineCheckSummary(
	stateLabel string,
	evaluatedVMs []mo.VirtualMachine,
	vmsNeedingConsolidation []mo.VirtualMachine,
	rps []mo.ResourcePool,
) string

VMDiskConsolidationOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func VMDiskConsolidationReport added in v0.14.0

func VMDiskConsolidationReport(
	c *vim25.Client,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsNeedingConsolidation []mo.VirtualMachine,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

VMDiskConsolidationReport generates a summary of VMs which require disk consolidation along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func VMInteractiveQuestionOneLineCheckSummary added in v0.15.0

func VMInteractiveQuestionOneLineCheckSummary(
	stateLabel string,
	evaluatedVMs []mo.VirtualMachine,
	vmsNeedingResponse []mo.VirtualMachine,
	rps []mo.ResourcePool,
) string

VMInteractiveQuestionOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func VMInteractiveQuestionReport added in v0.15.0

func VMInteractiveQuestionReport(
	c *vim25.Client,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsNeedingResponse []mo.VirtualMachine,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

VMInteractiveQuestionReport generates a summary of VMs which require an interactive response along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func VMNames added in v0.14.0

func VMNames(vmsList []mo.VirtualMachine) []string

VMNames receives a list of VirtualMachine values and returns a new list of VirtualMachine Name values.

func VMPowerCycleUptimeOneLineCheckSummary added in v0.10.0

func VMPowerCycleUptimeOneLineCheckSummary(
	stateLabel string,
	evaluatedVMs []mo.VirtualMachine,
	uptimeSummary VirtualMachinePowerCycleUptimeStatus,
	rps []mo.ResourcePool,
) string

VMPowerCycleUptimeOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func VMPowerCycleUptimeReport added in v0.10.0

func VMPowerCycleUptimeReport(
	c *vim25.Client,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	uptimeSummary VirtualMachinePowerCycleUptimeStatus,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

VMPowerCycleUptimeReport generates a summary of VMs which exceed power cycle uptime thresholds along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func VMToolsOneLineCheckSummary

func VMToolsOneLineCheckSummary(
	stateLabel string,
	evaluatedVMs []mo.VirtualMachine,
	vmsWithIssues []mo.VirtualMachine,
	rps []mo.ResourcePool,
) string

VMToolsOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func VMToolsReport

func VMToolsReport(
	c *vim25.Client,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsWithIssues []mo.VirtualMachine,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

VMToolsReport generates a comprehensive summary including any active issues along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func ValidateDCs added in v0.17.0

func ValidateDCs(ctx context.Context, c *vim25.Client, datacenters []string) error

ValidateDCs receives a list of Datacenter names and compares against all visible Datacenter objects within the vSphere environment. If any are not found an error is returned listing which ones. If an empty list of Datacenter names is provided validation is considered successful.

func ValidateDatastoreAccessibility added in v0.27.0

func ValidateDatastoreAccessibility(ds mo.Datastore) ([]string, error)

ValidateDatastoreAccessibility evaluates a given Datastore's accessibility and returns a list of reasons why and an error if the datastore is inaccessible. If the Datastore is accessible, nil is returned for both values.

func ValidateDatastoreStatsCollectionStatus added in v0.27.0

func ValidateDatastoreStatsCollectionStatus(datastore mo.Datastore) error

ValidateDatastoreStatsCollectionStatus returns nil indicating that statistics collection for a Datastore is enabled or an error which provides more information.

func ValidateRPs

func ValidateRPs(ctx context.Context, c *vim25.Client, includeRPs []string, excludeRPs []string) error

ValidateRPs is responsible for receiving two lists of resource pools, explicitly "included" (aka, "whitelisted") and explicitly "excluded" (aka, "blacklisted"). If any list entries are not found in the vSphere environment an error is returned listing which ones.

func VirtualCPUsOneLineCheckSummary

func VirtualCPUsOneLineCheckSummary(
	stateLabel string,
	vCPUsAllocated int32,
	vCPUsMax int,
	evaluatedVMs []mo.VirtualMachine,
	rps []mo.ResourcePool,
) string

VirtualCPUsOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func VirtualCPUsReport

func VirtualCPUsReport(
	c *vim25.Client,
	vCPUsAllocated int32,
	vCPUsMax int,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

VirtualCPUsReport generates a summary of vCPU usage along with various verbose details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

func VirtualHardwareOneLineCheckSummary

func VirtualHardwareOneLineCheckSummary(
	stateLabel string,
	hwvIndex HardwareVersionsIndex,
	minHardwareVersion int,
	evaluatedVMs []mo.VirtualMachine,
	rps []mo.ResourcePool,
) string

VirtualHardwareOneLineCheckSummary is used to generate a one-line Nagios service check results summary. This is the line most prominent in notifications.

func VirtualHardwareReport

func VirtualHardwareReport(
	c *vim25.Client,
	hwvIndex HardwareVersionsIndex,
	minHardwareVersion int,
	defaultHardwareVersion HardwareVersion,
	allVMs []mo.VirtualMachine,
	evaluatedVMs []mo.VirtualMachine,
	vmsToExclude []string,
	evalPoweredOffVMs bool,
	includeRPs []string,
	excludeRPs []string,
	rps []mo.ResourcePool,
) string

VirtualHardwareReport generates a summary of virtual hardware details intended to aid in troubleshooting check results at a glance. This information is provided for use with the Long Service Output field commonly displayed on the detailed service check results display in the web UI or in the body of many notifications.

Types

type AlarmEntity added in v0.16.0

type AlarmEntity struct {

	// Name is the name of the entity (e.g., HUSVM-DC1-vol6) associated with a
	// triggered alarm.
	Name string

	// OverallStatus is the entity's top-level or overall status. vSphere
	// represents this status (aka, ManagedEntityStatus) as a color (gray,
	// green, red or yellow) with green indicating "OK" and red "CRITICAL".
	OverallStatus types.ManagedEntityStatus

	// MOID is the Managed Object Reference of the entity.
	MOID types.ManagedObjectReference

	// ResourcePools are the names of the Resource Pool that the
	// TriggeredAlarm entity is part of. This applies to VirtualMachine and
	// ResourcePool types. VirtualMachine types have one entry and
	// ResourcePool types have two (self & parent).
	ResourcePools []string
}

AlarmEntity is the affected resource associated with an alarm. For example, for a triggered "Datastore usage on disk" alarm, AlarmEntity represents the affected datastore.

type CPUSpeed added in v0.9.0

type CPUSpeed float64

CPUSpeed represents the speed of a CPU

func (CPUSpeed) String added in v0.9.0

func (cpu CPUSpeed) String() string

type CustomAttribute added in v0.29.0

type CustomAttribute struct {
	Name  string
	Value string
}

CustomAttribute represents a name/value Custom Attribute pair. This pair is created by resolving a specific Custom Attribute Key associated with a Managed Object to its matching Custom Attribute Name, which is used to retrieve its Custom Attribute Value.

func GetObjectCustomAttribute added in v0.29.0

func GetObjectCustomAttribute(obj mo.ManagedEntity, customAttributeName string, ignoreMissingCA bool) (CustomAttribute, error)

GetObjectCustomAttribute receives a ManagedEntity (an abstract base type for all managed objects present in the inventory tree), a Custom Attribute name to retrieve a value for and a boolean flag indicating whether a ManagedEntity missing the Custom Attribute should be treated as an error. The specified Custom Attribute is returned if found. An error is returned if the specified Custom Attribute could be retrieved and the boolean flag did not indicate that this should be ignored.

type CustomAttributes added in v0.29.0

type CustomAttributes map[string]string

CustomAttributes represents the collection of Custom Attributes defined for a managed object.

func GetObjectCustomAttributes added in v0.29.0

func GetObjectCustomAttributes(obj mo.ManagedEntity) (CustomAttributes, error)

GetObjectCustomAttributes receives a ManagedEntity (an abstract base type for all managed objects present in the inventory tree) and returns an index of all Custom Attributes for the managed object. An error is returned if no Custom Attributes could be retrieved, indicating the cause of the failure.

func (CustomAttributes) String added in v0.29.0

func (cas CustomAttributes) String() string

String implements the Stringer interface to provide for a basic formatted list of Custom Attribute index entries.

type DatastoreIDToNameIndex added in v0.2.0

type DatastoreIDToNameIndex map[string]string

DatastoreIDToNameIndex maps a Datastore's ID value to its name.

type DatastorePerformanceSet added in v0.27.0

type DatastorePerformanceSet struct {

	// Datastore is the Managed Object associated with the collected Datastore
	// performance metrics.
	Datastore mo.Datastore

	// VMs provides a summary of details for all VirtualMachines found on the
	// specified datastore.
	VMs DatastoreVMs

	// Intervals is a collection of percentile to Datastore performance metric
	// indexes. Each element of this collection represents an interval or
	// window of time where metrics were collected. The first element contains
	// metrics for the active interval which are being actively aggregated.
	Intervals DatastorePerformanceSummaryIntervals
}

DatastorePerformanceSet is set of performance metrics for a specific Datastore. A collection of indexes is used to group metrics based on intervals or windows of time (e.g., X days worth of metrics, further grouped by percentile). Each group of metrics, known as a DatastorePerformanceSummary contains the thresholds necessary to evaluate metrics and determine overall plugin state.

FIXME: Not satisfied with the name. Revisit this.

DatastorePerformance, DatastorePerformanceSummaryCollection, DatastorePerformanceSet?

func NewDatastorePerformanceSet added in v0.27.0

func NewDatastorePerformanceSet(
	ctx context.Context,
	c *vim25.Client,
	ds mo.Datastore,
	thresholdsIndex DatastorePerformanceThresholdsIndex,
) (DatastorePerformanceSet, error)

NewDatastorePerformanceSet receives a Datastore and a specified thresholds index and retrieves performance summary information used to determine if storage latency levels have crossed user-specified thresholds.

func (DatastorePerformanceSet) ActiveIntervalMetrics added in v0.27.0

func (dps DatastorePerformanceSet) ActiveIntervalMetrics(percentile int) (DatastorePerformanceSummary, error)

ActiveIntervalMetrics returns the associated DatastorePerformanceSummary for a specified percentile from the active interval. An error is returned if an invalid percentile is specified.

func (DatastorePerformanceSet) ActivePerfSummaryIndex added in v0.27.0

func (dps DatastorePerformanceSet) ActivePerfSummaryIndex() (DatastorePerformanceSummaryIndex, error)

ActivePerfSummaryIndex returns the active DatastorePerformanceSummaryIndex from the set or an error if it is not available.

func (DatastorePerformanceSet) IsCriticalState added in v0.27.0

func (dps DatastorePerformanceSet) IsCriticalState() bool

IsCriticalState indicates whether a Datastore Performance Summary metric in the set has crossed the CRITICAL level threshold.

func (DatastorePerformanceSet) IsUnknownState added in v0.27.0

func (dps DatastorePerformanceSet) IsUnknownState() bool

IsUnknownState indicates whether a DatastorePerformanceSet is in an UNKNOWN state.

func (DatastorePerformanceSet) IsWarningState added in v0.27.0

func (dps DatastorePerformanceSet) IsWarningState() bool

IsWarningState indicates whether a Datastore Performance Summary metric in the set has crossed the WARNING level threshold.

func (DatastorePerformanceSet) IsZero added in v0.27.0

func (dps DatastorePerformanceSet) IsZero() bool

IsZero indicates whether all Datastore Performance Summary metrics for all percentiles in all indexes in the set are value 0.

func (DatastorePerformanceSet) UnknownState added in v0.27.0

func (dps DatastorePerformanceSet) UnknownState() error

UnknownState provides the associated error for a DatastorePerformanceSet's UNKNOWN state.

type DatastorePerformanceSummary added in v0.27.0

type DatastorePerformanceSummary struct {

	// DatastoreID is the Managed Object Reference (MOID or MoRef ID)
	// associated with the collected Datastore performance metrics.
	DatastoreMOID types.ManagedObjectReference

	// ReadIops is the aggregated datastore Read I/O rate (reads/second).
	ReadIops float64

	// ReadLatency is the aggregated datastore latency in milliseconds for
	// read operations.
	ReadLatency float64

	// VMLatency is the aggregated datastore latency as observed by
	// VirtualMachines using the datastore. The reported latency is in
	// milliseconds.
	VMLatency float64

	// WriteIops is the aggregated datastore Write I/O rate (writes/second).
	WriteIops float64

	// WriteLatency is the aggregated datastore latency in milliseconds for
	// write operations.
	WriteLatency float64

	// Percentile is the metric percentile specification.
	//
	// A percentile is a value between 1 and 100. Each metric value in this
	// type corresponds with the percentile value in this field. For example,
	// if the value of percentile is P, and the value of the ReadLatency is L,
	// then P% of all the read IOs performed during observation Interval is
	// less than L milliseconds.
	Percentile int32

	// Interval is the time period over which statistics are aggregated. The
	// reported time unit is in seconds.
	//
	// NOTE: By observation *only*, this appears to represent up to (roughly)
	// a full 24 hours before a new metrics collection entry is created. For
	// days where metrics have not been collected this is 0, for days where
	// stats have been collected values such as these have been noted:
	//
	// 86020, 85980, 86060, 83860
	Interval int32
	// contains filtered or unexported fields
}

DatastorePerformanceSummary tracks performance metrics for a specific Datastore.

https://vdc-download.vmware.com/vmwb-repository/dcr-public/bf660c0a-f060-46e8-a94d-4b5e6ffc77ad/208bc706-e281-49b6-a0ce-b402ec19ef82/SDK/vsphere-ws/docs/ReferenceGuide/vim.StorageResourceManager.html#queryDatastorePerformanceSummary https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.StorageResourceManager.StoragePerformanceSummary.html

func (DatastorePerformanceSummary) IsCriticalState added in v0.27.0

func (dps DatastorePerformanceSummary) IsCriticalState() bool

IsCriticalState indicates whether a Datastore Performance Summary metric has crossed the CRITICAL level threshold.

func (DatastorePerformanceSummary) IsWarningState added in v0.27.0

func (dps DatastorePerformanceSummary) IsWarningState() bool

IsWarningState indicates whether a Datastore Performance Summary metric has crossed the WARNING level threshold.

func (DatastorePerformanceSummary) IsZero added in v0.27.0

func (dps DatastorePerformanceSummary) IsZero() bool

IsZero indicates whether Datastore Performance Summary metrics are all value 0. This is a common occurrence after a new interval begins. For approximately 30 minutes no metrics are available until (presumably) sufficient time has elapsed to reliably generate aggregates of performance data. This can also occur if performance metrics collection is disabled for a Datastore.

func (DatastorePerformanceSummary) MetricsAboveThreshold added in v0.27.0

func (dps DatastorePerformanceSummary) MetricsAboveThreshold() []string

MetricsAboveThreshold returns a list of Datastore performance metrics which have exceeded specified thresholds.

type DatastorePerformanceSummaryIndex added in v0.27.0

type DatastorePerformanceSummaryIndex struct {

	// Entries is a map of percentile to Datastore Performance Summary
	// metrics.
	Entries map[int]DatastorePerformanceSummary

	// Active indicates whether the associated performance metrics are for the
	// active or "live" Interval or "window" of time.
	Active bool
}

DatastorePerformanceSummaryIndex is an index of Datastore performance metric percentile to DatastorePerformanceSummary values. At any time there is an active or "live" interval for aggregated metrics.

func (DatastorePerformanceSummaryIndex) IsCriticalState added in v0.27.0

func (dpsi DatastorePerformanceSummaryIndex) IsCriticalState() bool

IsCriticalState indicates whether a Datastore Performance Summary metric in the index has crossed the WARNING level threshold.

func (DatastorePerformanceSummaryIndex) IsWarningState added in v0.27.0

func (dpsi DatastorePerformanceSummaryIndex) IsWarningState() bool

IsWarningState indicates whether a Datastore Performance Summary metric in the index has crossed the WARNING level threshold.

func (DatastorePerformanceSummaryIndex) IsZero added in v0.27.0

func (dpsi DatastorePerformanceSummaryIndex) IsZero() bool

IsZero indicates whether all Datastore Performance Summary metrics for all percentiles in the index are value 0.

func (DatastorePerformanceSummaryIndex) Percentiles added in v0.27.0

func (dpsi DatastorePerformanceSummaryIndex) Percentiles() []int

Percentiles returns a sorted list of all Datastore Performance Summary percentiles in the index.

type DatastorePerformanceSummaryIntervals added in v0.27.0

type DatastorePerformanceSummaryIntervals []DatastorePerformanceSummaryIndex

DatastorePerformanceSummaryIntervals is a collection of DatastorePerformanceSummaryIndex values. Each element of this collection represents an interval or window of time where metrics were collected. The first element contains metrics for the active interval where metrics are being actively aggregated.

type DatastorePerformanceThresholds added in v0.27.0

type DatastorePerformanceThresholds struct {

	// ReadLatencyWarning is the read latency in ms when a WARNING threshold
	// is reached.
	ReadLatencyWarning float64

	// ReadLatencyCritical is the read latency in ms when a CRITICAL threshold
	// is reached.
	ReadLatencyCritical float64

	// WriteLatencyWarning is the write latency in ms when a WARNING threshold
	// is reached.
	WriteLatencyWarning float64

	// WriteLatencyCritical is the write latency in ms when a CRITICAL
	// threshold is reached.
	WriteLatencyCritical float64

	// VMLatencyWarning is the latency in ms as observed by VMs using the
	// datastore when a WARNING threshold is reached.
	VMLatencyWarning float64

	// VMLatencyCritical is the latency in ms as observed by VMs using the
	// datastore when a CRITICAL threshold is reached.
	VMLatencyCritical float64
}

DatastorePerformanceThresholds is a collection of threshold values used to determine the state of latency metrics for a specified Datastore.

type DatastorePerformanceThresholdsIndex added in v0.27.0

type DatastorePerformanceThresholdsIndex map[int]DatastorePerformanceThresholds

DatastorePerformanceThresholdsIndex is an index of Datastore Performance metrics percentile to DatastorePerformanceThresholds.

type DatastoreSpaceUsageSummary added in v0.28.0

type DatastoreSpaceUsageSummary struct {
	Datastore               mo.Datastore
	StorageRemainingPercent float64
	StorageUsedPercent      float64
	StorageTotal            int64
	StorageUsed             int64
	StorageRemaining        int64
	CriticalThreshold       int
	WarningThreshold        int
	VMs                     DatastoreVMs
}

DatastoreSpaceUsageSummary tracks usage details for a specific Datastore.

func NewDatastoreSpaceUsageSummary added in v0.28.0

func NewDatastoreSpaceUsageSummary(
	ctx context.Context,
	c *vim25.Client,
	ds mo.Datastore,
	criticalThreshold int,
	warningThreshold int,
) (DatastoreSpaceUsageSummary, error)

NewDatastoreSpaceUsageSummary receives a Datastore and generates summary information used to determine if usage levels have crossed user-specified thresholds. func NewDatastoreSpaceUsageSummary(ds mo.Datastore, dsVMs []mo.VirtualMachine, criticalThreshold int, warningThreshold int) DatastoreSpaceUsageSummary {

func (DatastoreSpaceUsageSummary) IsCriticalState added in v0.28.0

func (dus DatastoreSpaceUsageSummary) IsCriticalState() bool

IsCriticalState indicates whether Datastore usage has crossed the CRITICAL level threshold.

func (DatastoreSpaceUsageSummary) IsWarningState added in v0.28.0

func (dus DatastoreSpaceUsageSummary) IsWarningState() bool

IsWarningState indicates whether Datastore usage has crossed the WARNING level threshold.

type DatastoreVM added in v0.21.0

type DatastoreVM struct {

	// Name is the display name of the VirtualMachine.
	Name string

	// VMSize is the human readable or formatted size of the VirtualMachine.
	VMSize string

	// DatastoreSpaceUsage is the human readable or formatted percentage of the
	// Datastore space consumed by this VirtualMachine.
	DatastoreSpaceUsage string

	// PowerState tracks the current power state for a VirtualMachine.
	PowerState types.VirtualMachinePowerState

	// DatastoreMOID is the MOID or MoRef ID for the Datastore where this
	// VirtualMachine resides.
	DatastoreMOID types.ManagedObjectReference
}

DatastoreVM is a summary of details for a VirtualMachine found on a specific datastore.

type DatastoreVMs added in v0.21.0

type DatastoreVMs []DatastoreVM

DatastoreVMs provides an overview of all (visible) VirtualMachines residing on a specific Datastore.

func DatastoreVMsSummary added in v0.21.0

func DatastoreVMsSummary(ds mo.Datastore, vms []mo.VirtualMachine) DatastoreVMs

DatastoreVMsSummary evaluates provided Datastore and collection of VirtualMachines and provides a basic human readable / formatted summary of VirtualMachine details.

func (DatastoreVMs) NumVMsPoweredOff added in v0.21.0

func (dsVMs DatastoreVMs) NumVMsPoweredOff() int

NumVMsPoweredOff indicates how many VirtualMachines on a specific Datastore are powered off OR suspended.

func (DatastoreVMs) NumVMsPoweredOn added in v0.21.0

func (dsVMs DatastoreVMs) NumVMsPoweredOn() int

NumVMsPoweredOn indicates how many VirtualMachines on a specific Datastore are powered on.

type DatastoreWithCA added in v0.2.0

type DatastoreWithCA struct {
	mo.Datastore

	// CustomAttribute represents the name/value pair used to relate specific
	// hosts with specific datastores. Most often this takes the form of a
	// "Location" or "Datacenter" field to indicate which Datastore a
	// VirtualMachine should reside on when running on a specific HostSystem.
	CustomAttribute CustomAttribute
}

DatastoreWithCA wraps the vSphere Datastore managed object type with a specific Custom Attribute name/value pair. This Custom Attribute is intended to link this datastore to a specific ESXi host.

func GetDatastoresWithCA added in v0.22.0

func GetDatastoresWithCA(allDS []mo.Datastore, ignoredDatastoreNames []string, dsCustomAttributeName string, ignoreMissingCA bool) ([]DatastoreWithCA, error)

GetDatastoresWithCA receives a collection of Datastores, a list of datastore names that should be ignored or excluded from evaluation, a Custom Attribute name to filter Datastores by and a boolean flag indicating whether datastores missing a Custom Attribute should be ignored. A collection of DatastoreWithCA is returned along with an error (if applicable).

type ErrHostDatastoreIdxIDToNameLookupFailed added in v0.2.0

type ErrHostDatastoreIdxIDToNameLookupFailed struct {
	Err         error
	DatastoreID string
}

ErrHostDatastoreIdxIDToNameLookupFailed is returned when a search of the host to datastore index fails to yield a name for a specified ID value. This can occur if the datastore for a VM is in a user-specified ignored datastores list.

func (ErrHostDatastoreIdxIDToNameLookupFailed) Error added in v0.2.0

type HardwareVersion

type HardwareVersion struct {
	// contains filtered or unexported fields
}

HardwareVersion represents the virtual hardware version of a VirtualMachine.

func DefaultHardwareVersion added in v0.13.0

func DefaultHardwareVersion(
	ctx context.Context,
	c *vim25.Client,
	hostName string,
	clusterName string,
	datacenterName string,
	hardwareVersionsIdx HardwareVersionsIndex,
) (HardwareVersion, error)

DefaultHardwareVersion accepts optional host, cluster and datacenter names and returns the default hardware version. If not specified, an attempt will be made to use the default Datacenter and default ComputeResource (obtained using cluster name). If a host name is supplied, it will be used to obtain the default hardware version. If a host name and a cluster name are provided, an error will be returned.

The default version may not be the very latest version supported in the cluster (e.g., v14 is the default, but v15 is the latest supported).

func (HardwareVersion) Count

func (hv HardwareVersion) Count() int

Count returns the number of VirtualMachines with this specific virtual hardware version.

func (HardwareVersion) IsHighest

func (hv HardwareVersion) IsHighest() bool

IsHighest indicates whether this HardwareVersion is the highest version in our inventory.

func (HardwareVersion) String

func (hv HardwareVersion) String() string

String is a Stringer implementation to return the original formatted string.

func (HardwareVersion) VersionNumber

func (hv HardwareVersion) VersionNumber() int

VersionNumber returns the numeric version number of a VirtualMachine or -1 if there was an issue converting the prefixed string value to a usable number.

type HardwareVersions

type HardwareVersions []HardwareVersion

HardwareVersions represents a collection of HardwareVersion.

func (HardwareVersions) MeetsMinVersion added in v0.11.0

func (hvs HardwareVersions) MeetsMinVersion(minVer int) bool

MeetsMinVersion accepts the minimum hardware version for all VMs and indicates whether all hardware versions meet or exceed the minimum.

func (HardwareVersions) Sum

func (hvs HardwareVersions) Sum() int

Sum provides the total count of all HardwareVersion entries.

func (HardwareVersions) VersionNames

func (hvs HardwareVersions) VersionNames() []string

VersionNames returns a list of all hardware versions in their original string format.

func (HardwareVersions) VersionNumbers

func (hvs HardwareVersions) VersionNumbers() []int

VersionNumbers returns a list of all hardware versions in numerical format. -1 is returned for each hardware version if there was an issue converting the prefixed string value to a usable number.

type HardwareVersionsIndex

type HardwareVersionsIndex map[string]int

HardwareVersionsIndex is a map of hardware version to number of VMs present with that hardware version. This index serves as just that, an index. Accessor methods are provided to obtain HardwareVersion and HardwareVersions types which provide most of the useful methods for working with hardware version entries.

func NewHardwareVersionsIndex added in v0.26.0

func NewHardwareVersionsIndex(vms []mo.VirtualMachine) (HardwareVersionsIndex, error)

NewHardwareVersionsIndex creates an index of hardware version to number of Virtual Machines present with that hardware version. An error is returned if there is an issue accessing a Virtual Machine's configuration.

func (HardwareVersionsIndex) Count

func (hvi HardwareVersionsIndex) Count() int

Count returns the number of hardware versions stored in the index.

func (HardwareVersionsIndex) Newest

Newest returns the highest hardware version stored in the index. This value is returned as a HardwareVersion type, providing both the original vmx-123 formatted string in addition to the actual version number.

func (HardwareVersionsIndex) Oldest

Oldest returns the highest hardware version stored in the index. This value is returned as a HardwareVersion type, providing both the original vmx-123 formatted string in addition to the actual version number.

func (HardwareVersionsIndex) Outdated

func (hvi HardwareVersionsIndex) Outdated() HardwareVersions

Outdated returns a collection of all older HardwareVersion.

func (HardwareVersionsIndex) Versions

func (hvi HardwareVersionsIndex) Versions() HardwareVersions

Versions returns a collection of all HardwareVersion entries from the index.

type HostDatastoresPairing added in v0.2.0

type HostDatastoresPairing struct {
	Host       HostWithCA
	Datastores []DatastoreWithCA
}

HostDatastoresPairing collects Host and Datastores pairings based on shared Custom Attribute name and value (literal) or prefix (if user-specified). This is intended to "pair" hosts and datastores (using a specific Custom Attribute) within an environment that are known to work well together.

type HostSystemCPUSummary added in v0.9.0

type HostSystemCPUSummary struct {
	HostSystem          mo.HostSystem
	CPUUsedPercent      float64
	CPURemainingPercent float64

	// CPUUsed is the amount of CPU used by the host in Hz.
	CPUUsed float64

	// CPURemaining is the amount of CPU capacity remaining to the host in Hz.
	CPURemaining float64

	// CPUTotal is the total amount of CPU capacity for the host in Hz.
	CPUTotal          float64
	CriticalThreshold int
	WarningThreshold  int
}

HostSystemCPUSummary tracks CPU usage details for a specific HostSystem.

func NewHostSystemCPUUsageSummary added in v0.9.0

func NewHostSystemCPUUsageSummary(hs mo.HostSystem, criticalThreshold int, warningThreshold int) (HostSystemCPUSummary, error)

NewHostSystemCPUUsageSummary receives a HostSystem and generates summary information used to determine if usage levels have crossed user-specified thresholds. If required information is not accessible (e.g., permissions issue for service account) an error is returned indicating this.

func (HostSystemCPUSummary) IsCriticalState added in v0.9.0

func (hss HostSystemCPUSummary) IsCriticalState() bool

IsCriticalState indicates whether HostSystem CPU usage has crossed the CRITICAL level threshold.

func (HostSystemCPUSummary) IsWarningState added in v0.9.0

func (hss HostSystemCPUSummary) IsWarningState() bool

IsWarningState indicates whether HostSystem CPU usage has crossed the WARNING level threshold.

type HostSystemMemorySummary added in v0.9.0

type HostSystemMemorySummary struct {
	HostSystem             mo.HostSystem
	MemoryUsedPercent      float64
	MemoryRemainingPercent float64

	// MemoryUsed is the amount of memory used by the host in bytes.
	MemoryUsed int64

	// MemoryUsed is the amount of memory remaining to the host in bytes.
	MemoryRemaining int64

	// MemoryTotal is the total amount of memory for the host in bytes.
	MemoryTotal       int64
	CriticalThreshold int
	WarningThreshold  int
}

HostSystemMemorySummary tracks memory usage details for a specific HostSystem.

func NewHostSystemMemoryUsageSummary added in v0.9.0

func NewHostSystemMemoryUsageSummary(hs mo.HostSystem, criticalThreshold int, warningThreshold int) (HostSystemMemorySummary, error)

NewHostSystemMemoryUsageSummary receives a HostSystem and generates summary information used to determine if usage levels have crossed user-specified thresholds. If required information is not accessible (e.g., permissions issue for service account) an error is returned indicating this.

func (HostSystemMemorySummary) IsCriticalState added in v0.9.0

func (hss HostSystemMemorySummary) IsCriticalState() bool

IsCriticalState indicates whether HostSystem memory usage has crossed the CRITICAL level threshold.

func (HostSystemMemorySummary) IsWarningState added in v0.9.0

func (hss HostSystemMemorySummary) IsWarningState() bool

IsWarningState indicates whether HostSystem memory usage has crossed the WARNING level threshold.

type HostToDatastoreIndex added in v0.2.0

type HostToDatastoreIndex map[string]HostDatastoresPairing

HostToDatastoreIndex indexes HostDatastorePairings based on host id values.

func NewHostToDatastoreIndex added in v0.2.0

func NewHostToDatastoreIndex(
	hosts []HostWithCA,
	datastores []DatastoreWithCA,
	usingPrefixes bool,
	hostCASep string,
	datastoreCASep string,
) (HostToDatastoreIndex, error)

NewHostToDatastoreIndex receives a collection of hosts and datastores wrapped with user-specified Custom Attributes, prefix separators and a boolean flag indicating whether prefix matching will be used.

The index is created using each ESXi host's MOID as the key and a HostDatastoresPairing type as the value. This effectively provides a mapping between a host and all datastores with matching specified custom attribute. If no datastores are found with a matching specified custom attribute, an empty list of datastores is recorded for the host to indicate this.

The resulting HostToDatastoreIndex is returned if no errors occur, otherwise nil and the error.

func (HostToDatastoreIndex) DatastoreIDToName added in v0.2.0

func (hdi HostToDatastoreIndex) DatastoreIDToName(dsID string) (string, error)

DatastoreIDToName returns the name associated with a Datastore ID. An error is returned if the name could not be retrieved from the index.

func (HostToDatastoreIndex) DatastoreIDToNameIndex added in v0.2.0

func (hdi HostToDatastoreIndex) DatastoreIDToNameIndex() DatastoreIDToNameIndex

DatastoreIDToNameIndex returns an index of all Datastore IDs to names in the index.

func (HostToDatastoreIndex) DatastoreNames added in v0.2.0

func (hdi HostToDatastoreIndex) DatastoreNames() []string

DatastoreNames returns a list of all Datastore names in the index.

func (HostToDatastoreIndex) DatastoreWithCAByID added in v0.29.2

func (hdi HostToDatastoreIndex) DatastoreWithCAByID(dsID string) (DatastoreWithCA, error)

DatastoreWithCAByID returns the DatastoreWithCA value associated with a Datastore ID. An error is returned if the DatastoreWithCA value was not found in the index.

func (HostToDatastoreIndex) IsDatastoreIDInIndex added in v0.2.0

func (hdi HostToDatastoreIndex) IsDatastoreIDInIndex(dsID string) bool

IsDatastoreIDInIndex indicates whether a provided Datastore ID is in the index.

func (HostToDatastoreIndex) ValidateVirtualMachinePairings added in v0.2.0

func (hdi HostToDatastoreIndex) ValidateVirtualMachinePairings(
	vm mo.VirtualMachine,
	allDatastores []mo.Datastore,
	dsNamesToIgnore []string,
) ([]DatastoreWithCA, error)

ValidateVirtualMachinePairings receives a VirtualMachine host ID, a collection of all Datastores, the VirtualMachine, and an optional list of Datastore names to ignore. An index of mismatched virtual machine to host and datastore pairings (if applicable) is returned or an error if one occurs.

type HostWithCA added in v0.2.0

type HostWithCA struct {
	mo.HostSystem

	// CustomAttribute represents the name/value pair used to relate specific
	// hosts with specific datastores. Most often this takes the form of a
	// "Location" or "Datacenter" field to indicate which Datastore a
	// VirtualMachine should reside on when running on a specific HostSystem.
	CustomAttribute CustomAttribute
}

HostWithCA wraps the vSphere HostSystem managed object type with a specific Custom Attribute name/value pair. This Custom Attribute is intended to link this host to one or more datastores.

func GetHostsWithCA added in v0.22.0

func GetHostsWithCA(allHosts []mo.HostSystem, hostCustomAttributeName string, ignoreMissingCA bool) ([]HostWithCA, error)

GetHostsWithCA receives a collection of Hosts, a Custom Attribute name to filter Hosts by and a boolean flag indicating whether Hosts missing a Custom Attribute should be ignored. A collection of HostWithCA is returned along with an error (if applicable).

type ResourcePoolsAggregateStats added in v0.30.0

type ResourcePoolsAggregateStats struct {
	// MemoryUsageInBytes is the consumed host memory in bytes for one or more
	// specified Resource Pools.
	MemoryUsageInBytes int64

	// BalloonedMemoryInBytes is the size of the balloon driver in bytes
	// across all virtual machines in one or more specified Resource Pools.
	// The host will inflate the balloon driver to reclaim physical memory
	// from a virtual machine. This is a sign that there is memory pressure on
	// the host.
	BalloonedMemoryInBytes int64

	// SwappedMemoryInBytes is the the portion of memory in bytes that is granted
	// to virtual machines from the host's swap space. This is a sign that
	// there is memory pressure on the host.
	SwappedMemoryInBytes int64
}

ResourcePoolsAggregateStats is a collection of aggregated statistics for one or more Resource Pools.

func ResourcePoolStats added in v0.30.0

func ResourcePoolStats(ctx context.Context, client *vim25.Client, resourcePools []mo.ResourcePool) (ResourcePoolsAggregateStats, error)

ResourcePoolStats receives a collection of ResourcePool values and returns a collection of aggregate statistics (e.g., memory usage, ballooned memory, swapped memory, etc.). An error is returned if required properties are missing for one or more of the ResourcePool values and an initial attempt to populate the properties fails.

func (ResourcePoolsAggregateStats) BalloonedMemoryHR added in v0.30.0

func (rps ResourcePoolsAggregateStats) BalloonedMemoryHR() string

BalloonedMemoryHR returns the size of the balloon driver across all virtual machines in one or more specified Resource Pools as a human readable string.

func (ResourcePoolsAggregateStats) MemoryUsageHR added in v0.30.0

func (rps ResourcePoolsAggregateStats) MemoryUsageHR() string

MemoryUsageHR returns the consumed host memory for one or more specified Resource Pools as a human readable string.

func (ResourcePoolsAggregateStats) SwappedMemoryHR added in v0.30.0

func (rps ResourcePoolsAggregateStats) SwappedMemoryHR() string

SwappedMemoryHR returns the portion of memory granted to all virtual machines from the host's swap space across all virtual machines in one or more specified Resource Pools as a human readable string.

type SnapshotSummary added in v0.4.0

type SnapshotSummary struct {

	// Name of the snapshot in human readable format.
	Name string

	// MOID is the Managed Object Reference value for the snapshot.
	MOID string

	// Description of the snapshot in human readable format.
	Description string

	// VMName is the name of the VirtualMachine associated with the snapshot.
	VMName string

	// DatastoreName is the name of the associated datastore for the snapshot.
	DatastoreName string

	// Size is the size of the snapshot.
	Size int64

	// ID is the unique identifier that distinguishes this snapshot from other
	// snapshots of the virtual machine.
	ID int32
	// contains filtered or unexported fields
}

SnapshotSummary is intended to be a summary of the most commonly used snapshot details for a specific VirtualMachine snapshot.

func (SnapshotSummary) Age added in v0.4.0

func (ss SnapshotSummary) Age() string

Age returns the age of a snapshot in formatted days.

func (SnapshotSummary) AgeDays added in v0.4.0

func (ss SnapshotSummary) AgeDays() float64

AgeDays returns the age of a snapshot in days.

func (SnapshotSummary) IsAgeCriticalState added in v0.4.0

func (ss SnapshotSummary) IsAgeCriticalState() bool

IsAgeCriticalState indicates whether the snapshot has exceeded the age CRITICAL threshold.

func (SnapshotSummary) IsAgeExceeded added in v0.4.0

func (ss SnapshotSummary) IsAgeExceeded(days int) bool

IsAgeExceeded indicates whether the snapshot is older than the specified number of days.

func (SnapshotSummary) IsAgeWarningState added in v0.4.0

func (ss SnapshotSummary) IsAgeWarningState() bool

IsAgeWarningState indicates whether the snapshot has exceeded the age WARNING threshold but NOT the CRITICAL age threshold.

func (SnapshotSummary) IsCriticalState added in v0.4.0

func (ss SnapshotSummary) IsCriticalState() bool

IsCriticalState indicates whether the snapshot has exceeded age or size CRITICAL thresholds.

func (SnapshotSummary) IsSizeCriticalState added in v0.4.0

func (ss SnapshotSummary) IsSizeCriticalState() bool

IsSizeCriticalState indicates whether the snapshot has exceeded the size CRITICAL threshold.

func (SnapshotSummary) IsSizeExceeded added in v0.5.0

func (ss SnapshotSummary) IsSizeExceeded(sizeGB int) bool

IsSizeExceeded indicates whether the snapshot is larger than the specified size in GB.

func (SnapshotSummary) IsSizeWarningState added in v0.4.0

func (ss SnapshotSummary) IsSizeWarningState() bool

IsSizeWarningState indicates whether the snapshot has exceeded the size WARNING threshold but NOT the CRITICAL size threshold.

func (SnapshotSummary) IsWarningState added in v0.4.0

func (ss SnapshotSummary) IsWarningState() bool

IsWarningState indicates whether the snapshot has exceeded age or size WARNING thresholds but NOT age or size CRITICAL thresholds.

func (SnapshotSummary) SizeHR added in v0.4.0

func (ss SnapshotSummary) SizeHR() string

SizeHR returns the human readable size of the snapshot.

type SnapshotSummarySet added in v0.4.0

type SnapshotSummarySet struct {

	// VM is the Managed Object Reference for the VirtualMachine associated
	// with the snapshots in this set.
	VM types.ManagedObjectReference

	// VMName is the name of the VirtualMachine associated with the snapshots
	// in this set.
	VMName string

	// Snapshots is the collection of higher level summary values for
	// snapshots associated with a specific VirtualMachine.
	Snapshots []SnapshotSummary
	// contains filtered or unexported fields
}

SnapshotSummarySet ties a collection of snapshot summary values to a specific VirtualMachine by way of a VirtualMachine Managed Object Reference.

func NewSnapshotSummarySet added in v0.4.0

func NewSnapshotSummarySet(
	vm mo.VirtualMachine,
	snapshotThresholds SnapshotThresholds,
) SnapshotSummarySet

NewSnapshotSummarySet returns a set of SnapshotSummary values for snapshots associated with a specified VirtualMachine.

func (SnapshotSummarySet) ExceedsAge added in v0.4.0

func (sss SnapshotSummarySet) ExceedsAge(days int) int

ExceedsAge indicates how many snapshots in the set are older than the specified number of days. Unlike the ExceedsAge method for SnapshotSummarySets, this method focuses specifically on individual snapshots.

func (SnapshotSummarySet) ExceedsSize added in v0.5.0

func (sss SnapshotSummarySet) ExceedsSize(sizeGB int) int

ExceedsSize indicates how many snapshots in the set are larger than the specified size in GB. Unlike the ExceedsSize method for SnapshotSummarySets, this method focuses specifically on individual snapshot size.

func (SnapshotSummarySet) IsAgeCriticalState added in v0.4.0

func (sss SnapshotSummarySet) IsAgeCriticalState() bool

IsAgeCriticalState indicates whether the snapshot set has exceeded the age CRITICAL threshold.

func (SnapshotSummarySet) IsAgeWarningState added in v0.4.0

func (sss SnapshotSummarySet) IsAgeWarningState() bool

IsAgeWarningState indicates whether the snapshot set has exceeded the age WARNING threshold, but NOT the age CRITICAL threshold.

func (SnapshotSummarySet) IsCountCriticalState added in v0.7.0

func (sss SnapshotSummarySet) IsCountCriticalState() bool

IsCountCriticalState indicates whether the snapshot set has exceeded the snapshots count CRITICAL threshold.

func (SnapshotSummarySet) IsCountWarningState added in v0.7.0

func (sss SnapshotSummarySet) IsCountWarningState() bool

IsCountWarningState indicates whether the snapshot set has exceeded the snapshots count WARNING threshold, but NOT the snapshots count CRITICAL threshold.

func (SnapshotSummarySet) IsCriticalState added in v0.4.0

func (sss SnapshotSummarySet) IsCriticalState() bool

IsCriticalState indicates whether the snapshot set has exceeded age, size or count CRITICAL thresholds.

func (SnapshotSummarySet) IsSizeCriticalState added in v0.4.0

func (sss SnapshotSummarySet) IsSizeCriticalState() bool

IsSizeCriticalState indicates whether the snapshot set has exceeded the size CRITICAL threshold.

func (SnapshotSummarySet) IsSizeWarningState added in v0.4.0

func (sss SnapshotSummarySet) IsSizeWarningState() bool

IsSizeWarningState indicates whether the snapshot set has exceeded the size WARNING threshold, but NOT the size CRITICAL threshold.

func (SnapshotSummarySet) IsWarningState added in v0.4.0

func (sss SnapshotSummarySet) IsWarningState() bool

IsWarningState indicates whether the snapshot set has snapshots which have an age, size or count WARNING state.

func (SnapshotSummarySet) Size added in v0.4.0

func (sss SnapshotSummarySet) Size() int64

Size returns the size of all snapshots in the set.

func (SnapshotSummarySet) SizeHR added in v0.4.0

func (sss SnapshotSummarySet) SizeHR() string

SizeHR returns the human readable size of all snapshots in the set.

type SnapshotSummarySets added in v0.4.0

type SnapshotSummarySets []SnapshotSummarySet

SnapshotSummarySets is a collection of SnapshotSummarySet types for bulk operations. Most often this is used when determining the overall state of all sets in the collection.

func (SnapshotSummarySets) AgeCriticalSnapshots added in v0.25.0

func (sss SnapshotSummarySets) AgeCriticalSnapshots() (int, int)

AgeCriticalSnapshots returns the number of sets and number of snapshots from all of those sets that are older than the specified CRITICAL age threshold. This effectively provides the number of VirtualMachines with (age) CRITICAL snapshots and the total (age) CRITICAL snapshots across all VirtualMachines.

func (SnapshotSummarySets) AgeWarningSnapshots added in v0.25.0

func (sss SnapshotSummarySets) AgeWarningSnapshots() (int, int)

AgeWarningSnapshots returns the number of sets and number of snapshots from all of those sets that are older than the specified WARNING age threshold but have *not* yet crossed the CRITICAL threshold. This effectively provides the number of VirtualMachines with (age) WARNING snapshots and the total (age) WARNING snapshots across all VirtualMachines.

func (SnapshotSummarySets) CountCriticalSnapshots added in v0.25.0

func (sss SnapshotSummarySets) CountCriticalSnapshots() (int, int)

CountCriticalSnapshots returns the number of sets and number of snapshots from all of those sets that are greater than the specified CRITICAL count threshold. This effectively provides the number of VirtualMachines with CRITICAL snapshots and the total CRITICAL snapshots across all VirtualMachines.

func (SnapshotSummarySets) CountWarningSnapshots added in v0.25.0

func (sss SnapshotSummarySets) CountWarningSnapshots() (int, int)

CountWarningSnapshots returns the number of sets and number of snapshots from all of those sets that are greater than the specified WARNING age threshold but have *not* yet crossed the CRITICAL threshold. This effectively provides the number of VirtualMachines with WARNING snapshots and the total WARNING snapshots across all VirtualMachines.

func (SnapshotSummarySets) ExceedsAge added in v0.4.0

func (sss SnapshotSummarySets) ExceedsAge(days int) (int, int)

ExceedsAge indicates how many sets and number of snapshots from all of those sets are older than the specified number of days.

func (SnapshotSummarySets) ExceedsSize added in v0.5.0

func (sss SnapshotSummarySets) ExceedsSize(sizeGB int) (int, int)

ExceedsSize indicates how many sets and number of snapshots from all of those sets have cumulative snapshots larger than the specified size in GB.

func (SnapshotSummarySets) ExcessSnapshots added in v0.7.0

func (sss SnapshotSummarySets) ExcessSnapshots(count int) (int, int, int)

ExcessSnapshots indicates how many sets have excess snapshots, how many excess snapshots there are and how many total snapshots there are.

func (SnapshotSummarySets) FilterByCount added in v0.7.0

func (sss SnapshotSummarySets) FilterByCount(count int) SnapshotSummarySets

FilterByCount returns a SnapshotSummarySets value containing only sets which have snapshots in excess of the specified number.

func (SnapshotSummarySets) HasNotYetExceededAge added in v0.5.0

func (sss SnapshotSummarySets) HasNotYetExceededAge(days int) bool

HasNotYetExceededAge indicates whether any of the snapshots in any of the sets have yet to exceed the threshold for the specified number of days.

func (SnapshotSummarySets) HasNotYetExceededCount added in v0.7.0

func (sss SnapshotSummarySets) HasNotYetExceededCount(count int) bool

HasNotYetExceededCount indicates whether any of the sets have yet to exceed the threshold for the specified number of snapshots.

func (SnapshotSummarySets) HasNotYetExceededSize added in v0.5.0

func (sss SnapshotSummarySets) HasNotYetExceededSize(sizeGB int) bool

HasNotYetExceededSize indicates whether any snapshot set (all snapshots for a specific VM) has yet to exceed the threshold for the specified size in GB.

func (SnapshotSummarySets) IsAgeCriticalState added in v0.4.0

func (sss SnapshotSummarySets) IsAgeCriticalState() bool

IsAgeCriticalState indicates whether the snapshot sets have exceeded the age CRITICAL threshold.

func (SnapshotSummarySets) IsAgeWarningState added in v0.4.0

func (sss SnapshotSummarySets) IsAgeWarningState() bool

IsAgeWarningState indicates whether the snapshot sets have exceeded the age WARNING threshold, but NOT the age CRITICAL threshold.

func (SnapshotSummarySets) IsCountCriticalState added in v0.7.0

func (sss SnapshotSummarySets) IsCountCriticalState() bool

IsCountCriticalState indicates whether the snapshot sets have exceeded the count CRITICAL threshold.

func (SnapshotSummarySets) IsCountWarningState added in v0.7.0

func (sss SnapshotSummarySets) IsCountWarningState() bool

IsCountWarningState indicates whether the snapshot sets have exceeded the count WARNING threshold, but NOT the count CRITICAL threshold.

func (SnapshotSummarySets) IsCriticalState added in v0.4.0

func (sss SnapshotSummarySets) IsCriticalState() bool

IsCriticalState indicates whether the snapshot sets have exceeded age, size or count CRITICAL thresholds.

func (SnapshotSummarySets) IsSizeCriticalState added in v0.4.0

func (sss SnapshotSummarySets) IsSizeCriticalState() bool

IsSizeCriticalState indicates whether the snapshot sets have exceeded the size CRITICAL threshold.

func (SnapshotSummarySets) IsSizeWarningState added in v0.4.0

func (sss SnapshotSummarySets) IsSizeWarningState() bool

IsSizeWarningState indicates whether the snapshot sets have exceeded the size WARNING threshold, but NOT the size CRITICAL threshold.

func (SnapshotSummarySets) IsWarningState added in v0.4.0

func (sss SnapshotSummarySets) IsWarningState() bool

IsWarningState indicates whether the snapshot sets have exceeded age, size or count WARNING thresholds, but NOT CRITICAL thresholds.

func (SnapshotSummarySets) SizeCriticalSnapshots added in v0.25.0

func (sss SnapshotSummarySets) SizeCriticalSnapshots() (int, int)

SizeCriticalSnapshots returns the number of sets and number of snapshots from all of those sets whose cumulative size is larger than the specified CRITICAL size threshold. This effectively provides the number of VirtualMachines with (size) CRITICAL snapshots and the total (size) CRITICAL snapshots across all VirtualMachines.

func (SnapshotSummarySets) SizeWarningSnapshots added in v0.25.0

func (sss SnapshotSummarySets) SizeWarningSnapshots() (int, int)

SizeWarningSnapshots returns the number of sets and number of snapshots from all of those sets whose cumulative size is larger than the specified WARNING age threshold but have *not* yet crossed the CRITICAL threshold. This effectively provides the number of VirtualMachines with (size) WARNING snapshots and the total (size) WARNING snapshots across all VirtualMachines.

func (SnapshotSummarySets) Snapshots added in v0.5.1

func (sss SnapshotSummarySets) Snapshots() int

Snapshots indicates how many snapshots are in all of the sets.

type SnapshotThresholds added in v0.7.0

type SnapshotThresholds struct {
	AgeCritical   int
	AgeWarning    int
	SizeCritical  int
	SizeWarning   int
	CountCritical int
	CountWarning  int
}

SnapshotThresholds represents the specific thresholds used to determine whether one or many snapshots are considered to be in a CRITICAL or WARNING state.

type SnapshotsIndex added in v0.4.0

type SnapshotsIndex map[string]types.VirtualMachineSnapshotTree

SnapshotsIndex is a mapping of Snapshot ManagedObjectReference to a tree of snapshot details. This type is intended to help with producing a superset type combining a summary of snapshot metadata with the original VirtualMachine object.

Deprecated ?

type TriggeredAlarm added in v0.16.0

type TriggeredAlarm struct {

	// Entity is the affected resource associated with the triggered alarm.
	Entity AlarmEntity

	// AcknowledgedTime is the time when the triggered alarm was acknowledged
	// by an admin. Defaults to zero value if the triggered alarm has not been
	// acknowledged.
	AcknowledgedTime time.Time

	// Time is when the alarm was triggered.
	Time time.Time

	// Name is the name of the defined alarm.
	Name string

	// MOID is the Managed Object Reference to the defined alarm.
	MOID types.ManagedObjectReference

	// Key is the unique identifier for the triggered alarm or alarm "state"
	// (AlarmState), not the defined alarm (AlarmInfo).
	Key string

	// Description is the description of the defined alarm.
	Description string

	// Datacenter is the datacenter where the alarm was triggered.
	Datacenter string

	// AcknowledgedByUser is the user which acknowledged the alarm.
	AcknowledgedByUser string

	// ExcludeReason gives a brief explanation of why a TriggeredAlarm is
	// excluded.
	ExcludeReason string

	// OverallStatus is the alarm's top-level or overall status of the alarm.
	// vSphere represents this status (aka, ManagedEntityStatus) as a color
	// (gray, green, red or yellow) with green indicating "OK" and red
	// "CRITICAL".
	OverallStatus types.ManagedEntityStatus

	// Acknowledged indicates whether the triggered alarm has been
	// acknowledged by an admin user.
	Acknowledged bool

	// Exclude indicates whether the TriggeredAlarm has been excluded from
	// final evaluation. During processing multiple filters are applied. We
	// track exclusion state through the filtering pipeline so that any
	// explicit inclusions chosen by the sysadmin will have the opportunity to
	// reset this state and have the TriggeredAlarm considered for evaluation.
	Exclude bool

	// ExplicitlyIncluded indicates whether the TriggeredAlarm has been marked
	// for explicit inclusion by a step in the filtering pipeline. A
	// TriggeredAlarm marked in this way is not "dropped" by later explicit
	// inclusion filtering steps in the pipeline.
	ExplicitlyIncluded bool

	// ExplicitlyExcluded indicates whether the TriggeredAlarm has been marked
	// for explicit exclusion by a step in the filtering pipeline.
	ExplicitlyExcluded bool
}

TriggeredAlarm represents the state of an alarm along with the affected resource associated with the alarm.

func (TriggeredAlarm) Excluded added in v0.17.0

func (ta TriggeredAlarm) Excluded() bool

Excluded indicates whether a TriggeredAlarm has been excluded implicitly (for now) or explicitly (permanently) from further evaluation.

func (TriggeredAlarm) ExcludedFinal added in v0.17.0

func (ta TriggeredAlarm) ExcludedFinal() bool

ExcludedFinal indicates whether a TriggeredAlarm has been permanently excluded from further evaluation.

type TriggeredAlarmFilters added in v0.17.0

type TriggeredAlarmFilters struct {
	IncludedAlarmEntityTypes         []string
	ExcludedAlarmEntityTypes         []string
	IncludedAlarmEntityNames         []string
	ExcludedAlarmEntityNames         []string
	IncludedAlarmEntityResourcePools []string
	ExcludedAlarmEntityResourcePools []string
	IncludedAlarmNames               []string
	ExcludedAlarmNames               []string
	IncludedAlarmDescriptions        []string
	ExcludedAlarmDescriptions        []string
	IncludedAlarmStatuses            []string
	ExcludedAlarmStatuses            []string
	EvaluateAcknowledgedAlarms       bool
}

TriggeredAlarmFilters is a collection of the options specified by the user for filtering detected TriggeredAlarms. This is most often used for providing summary information in logging or user-facing output.

type TriggeredAlarms added in v0.16.0

type TriggeredAlarms []TriggeredAlarm

TriggeredAlarms is a collection of alarms which have been triggered across one or more Datacenters.

func GetTriggeredAlarms added in v0.16.0

func GetTriggeredAlarms(ctx context.Context, c *govmomi.Client, datacenters []mo.Datacenter, propsSubset bool) (TriggeredAlarms, error)

GetTriggeredAlarms accepts a list of Datacenters and a boolean value indicating whether only a subset of properties for datacenters and alarms should be returned. If requested, a subset of all available properties will be retrieved (faster) instead of recursively fetching all properties (about 2x as slow). Any TriggeredAlarms found are returned or an error if an empty list is provided or if there are issues retrieving properties for any TriggeredAlarms.

func (TriggeredAlarms) CountPerDatacenter added in v0.16.0

func (tas TriggeredAlarms) CountPerDatacenter() map[string]int

CountPerDatacenter returns a map of Datacenter name to triggered alarms associated with the Datacenter name.

func (TriggeredAlarms) Datacenters added in v0.16.0

func (tas TriggeredAlarms) Datacenters() []string

Datacenters returns a list of Datacenter names associated with the collection of TriggeredAlarms.

func (*TriggeredAlarms) Filter added in v0.17.0

func (tas *TriggeredAlarms) Filter(filters TriggeredAlarmFilters)

Filter explicitly includes or excludes TriggeredAlarms based on specified filter settings.

func (*TriggeredAlarms) FilterByAcknowledgedState added in v0.17.0

func (tas *TriggeredAlarms) FilterByAcknowledgedState(includeAcknowledged bool)

FilterByAcknowledgedState accepts a boolean value to indicate whether previously acknowledged alarms should be included in the final evaluation.

If false, previously acknowledged TriggeredAlarms are marked as explicitly excluded and will be "dropped" from further evaluation in the filtering pipeline. If true, no changes are made. Further evaluation in the filtering pipeline can still mark the TriggeredAlarm as excluded.

func (*TriggeredAlarms) FilterByExcludedDescriptionSubstring added in v0.17.0

func (tas *TriggeredAlarms) FilterByExcludedDescriptionSubstring(exclude []string)

FilterByExcludedDescriptionSubstring accepts a slice of substrings to use in comparisons against TriggeredAlarm descriptions in order to explicitly mark TriggeredAlarms for exclusion in the final evaluation. Flag evaluation logic prevents sysadmins from providing both an inclusion and exclusion list.

func (*TriggeredAlarms) FilterByExcludedEntityResourcePool added in v0.17.0

func (tas *TriggeredAlarms) FilterByExcludedEntityResourcePool(exclude []string)

FilterByExcludedEntityResourcePool accepts a slice of Resource Pool names to use in comparison against the Resource Pool for an entity associated with a TriggeredAlarm. For any matches, the TriggeredAlarm is marked as explicitly excluded. This will result in "dropping" the TriggeredAlarm from further evaluation in the filtering pipeline.

func (*TriggeredAlarms) FilterByExcludedEntityType added in v0.17.0

func (tas *TriggeredAlarms) FilterByExcludedEntityType(excludeTypes []string)

FilterByExcludedEntityType accepts a slice of entity type keywords to use in comparison against the entity type associated with a TriggeredAlarm. For any matches, the TriggeredAlarm is marked as explicitly excluded. This will result in "dropping" the TriggeredAlarm from further evaluation in the filtering pipeline.

func (*TriggeredAlarms) FilterByExcludedNameSubstring added in v0.17.0

func (tas *TriggeredAlarms) FilterByExcludedNameSubstring(exclude []string)

FilterByExcludedNameSubstring accepts a slice of substrings to use in comparisons against TriggeredAlarm names in order to explicitly mark TriggeredAlarms for exclusion in the final evaluation. Flag evaluation logic prevents sysadmins from providing both an inclusion and exclusion list.

func (*TriggeredAlarms) FilterByExcludedStatus added in v0.17.0

func (tas *TriggeredAlarms) FilterByExcludedStatus(exclude []string)

FilterByExcludedStatus accepts a slice of ManagedEntityStatus keywords to use in comparisons against TriggeredAlarm statuses in order to explicitly mark TriggeredAlarms for exclusion in the final evaluation. Flag evaluation logic prevents sysadmins from providing both an inclusion and exclusion list.

func (*TriggeredAlarms) FilterByIncludedDescriptionSubstring added in v0.17.0

func (tas *TriggeredAlarms) FilterByIncludedDescriptionSubstring(include []string)

FilterByIncludedDescriptionSubstring accepts a slice of substrings to use in comparisons against TriggeredAlarm descriptions.

For any matches, the TriggeredAlarm is marked as explicitly included. This will prevent later filtering from implicitly excluding the TriggeredAlarm, but will not stop explicit exclusions from "dropping" the TriggeredAlarm from further evaluation in the filtering pipeline.

func (*TriggeredAlarms) FilterByIncludedEntityResourcePool added in v0.17.0

func (tas *TriggeredAlarms) FilterByIncludedEntityResourcePool(include []string)

FilterByIncludedEntityResourcePool accepts a slice of Resource Pool names to use in comparison against the Resource Pool for an entity associated with a TriggeredAlarm. For any matches, the TriggeredAlarm is marked as explicitly included. This will prevent later filtering from implicitly excluding the TriggeredAlarm, but will not stop explicit exclusions from "dropping" the TriggeredAlarm from further evaluation in the filtering pipeline.

func (*TriggeredAlarms) FilterByIncludedEntityType added in v0.17.0

func (tas *TriggeredAlarms) FilterByIncludedEntityType(includeTypes []string)

FilterByIncludedEntityType accepts a slice of entity type keywords to use in comparison against the entity type associated with a TriggeredAlarm. For any matches, the TriggeredAlarm is marked as explicitly included. This will prevent later filtering from implicitly excluding the TriggeredAlarm, but will not stop explicit exclusions from "dropping" the TriggeredAlarm from further evaluation in the filtering pipeline.

func (*TriggeredAlarms) FilterByIncludedNameSubstring added in v0.17.0

func (tas *TriggeredAlarms) FilterByIncludedNameSubstring(include []string)

FilterByIncludedNameSubstring accepts a slice of substrings to use in comparisons against TriggeredAlarm names. For any matches, the TriggeredAlarm is marked as explicitly included. This will prevent later filtering from implicitly excluding the TriggeredAlarm, but will not stop explicit exclusions from "dropping" the TriggeredAlarm from further evaluation in the filtering pipeline.

func (*TriggeredAlarms) FilterByIncludedStatus added in v0.17.0

func (tas *TriggeredAlarms) FilterByIncludedStatus(include []string)

FilterByIncludedStatus accepts a slice of ManagedEntityStatus keywords to use in comparisons against TriggeredAlarm statuses. For any matches, the TriggeredAlarm is marked as explicitly included. This will prevent later filtering from implicitly excluding the TriggeredAlarm, but will not stop explicit exclusions from "dropping" the TriggeredAlarm from further evaluation in the filtering pipeline.

func (TriggeredAlarms) FilterByKey added in v0.16.0

func (tas TriggeredAlarms) FilterByKey(key string) (TriggeredAlarm, error)

FilterByKey returns the matching TriggeredAlarm for the provided unique identifier (key) for a TriggeredAlarm.

func (TriggeredAlarms) HasCriticalState added in v0.16.0

func (tas TriggeredAlarms) HasCriticalState(evalExcluded bool) bool

HasCriticalState indicates whether the collection of TriggeredAlarms contains an alarm considered to be in a CRITICAL state. A boolean value is accepted which indicates whether TriggeredAlarm values marked for exclusion (during filtering) should also be considered. The caller is responsible for filtering the collection; processing of inclusion or exclusion lists should be performed prior to calling this method.

func (TriggeredAlarms) HasUnknownState added in v0.16.0

func (tas TriggeredAlarms) HasUnknownState(evalExcluded bool) bool

HasUnknownState indicates whether the collection of TriggeredAlarms contains an alarm considered to be in an UNKNOWN state. A boolean value is accepted which indicates whether TriggeredAlarm values marked for exclusion (during filtering) should also be considered. The caller is responsible for filtering the collection; processing of inclusion or exclusion lists should be performed prior to calling this method.

func (TriggeredAlarms) HasWarningState added in v0.16.0

func (tas TriggeredAlarms) HasWarningState(evalExcluded bool) bool

HasWarningState indicates whether the collection of TriggeredAlarms contains an alarm considered to be in a WARNING state. A boolean value is accepted which indicates whether TriggeredAlarm values marked for exclusion (during filter) should also be considered. The caller is responsible for filtering the collection; processing of inclusion or exclusion lists should be performed prior to calling this method.

func (TriggeredAlarms) IsOKState added in v0.16.0

func (tas TriggeredAlarms) IsOKState(evalExcluded bool) bool

IsOKState indicates whether all alarms in the collection of TriggeredAlarms are considered to be in an OK state. A boolean value is accepted to control whether all TriggeredAlarm values are evaluated or only those not marked for exclusion. The caller is responsible for filtering the collection; processing of inclusion or exclusion lists should be performed prior to calling this method.

func (TriggeredAlarms) Keys added in v0.16.0

func (tas TriggeredAlarms) Keys(evalAcknowledged bool, evalExcluded bool) []string

Keys returns a list of TriggeredAlarm keys or unique identifiers associated with each TriggeredAlarm in the collection. If specified, keys are also returned for acknowledged triggered alarms. Keys are returned in ascending order.

func (TriggeredAlarms) KeysExcluded added in v0.17.0

func (tas TriggeredAlarms) KeysExcluded() []string

KeysExcluded returns a list of TriggeredAlarm keys or unique identifiers associated with each TriggeredAlarm in the collection that has been excluded. Keys are returned in ascending order.

func (TriggeredAlarms) NumCriticalState added in v0.16.0

func (tas TriggeredAlarms) NumCriticalState(evalExcluded bool) int

NumCriticalState indicates how many TriggeredAlarms in the collection are considered to be in a CRITICAL state. A boolean value is accepted which indicates whether all TriggeredAlarm values are evaluated or only those not marked for exclusion. The caller is responsible for filtering the collection; processing of inclusion or exclusion lists should be performed prior to calling this method.

func (TriggeredAlarms) NumExcluded added in v0.17.0

func (tas TriggeredAlarms) NumExcluded() int

NumExcluded returns the number of TriggeredAlarms that have been implicitly or explicitly excluded.

func (TriggeredAlarms) NumExcludedFinal added in v0.17.0

func (tas TriggeredAlarms) NumExcludedFinal() int

NumExcludedFinal returns the number of TriggeredAlarms that have been explicitly excluded from further evaluation.

func (TriggeredAlarms) NumOKState added in v0.16.0

func (tas TriggeredAlarms) NumOKState(evalExcluded bool) int

NumOKState indicates how many TriggeredAlarms in the collection are considered to be in an OK state. A boolean value is accepted which indicates whether TriggeredAlarm values marked for exclusion (during filtering) should also be considered. The caller is responsible for filtering the collection; processing of inclusion or exclusion lists should be performed prior to calling this method.

func (TriggeredAlarms) NumUnknownState added in v0.16.0

func (tas TriggeredAlarms) NumUnknownState(evalExcluded bool) int

NumUnknownState indicates how many TriggeredAlarms in the collection are considered to be in an UNKNOWN state. A boolean value is accepted which indicates whether TriggeredAlarm values marked for exclusion (during filtering) should also be considered. The caller is responsible for filtering the collection; processing of inclusion or exclusion lists should be performed prior to calling this method.

func (TriggeredAlarms) NumWarningState added in v0.16.0

func (tas TriggeredAlarms) NumWarningState(evalExcluded bool) int

NumWarningState indicates how many TriggeredAlarms in the collection are considered to be in a WARNING state. A boolean value is accepted which indicates whether TriggeredAlarm values marked for exclusion (during filtering) should also be considered. The caller is responsible for filtering the collection; processing of inclusion or exclusion lists should be performed prior to calling this method.

func (TriggeredAlarms) ResourcePools added in v0.17.0

func (tas TriggeredAlarms) ResourcePools() []string

ResourcePools returns a list of ResourcePool names associated with the collection of TriggeredAlarms.

type VMToMismatchedPairing added in v0.29.2

type VMToMismatchedPairing map[string]HostDatastoresPairing

VMToMismatchedPairing indexes VirtualMachine name to a pairing of host and datastores. This index reflects mismatched Datastores based on the current host for the VirtualMachine.

func GetVMDatastorePairingIssues added in v0.22.0

func GetVMDatastorePairingIssues(vms []mo.VirtualMachine, h2dIdx HostToDatastoreIndex, dss []mo.Datastore, ignoredDatastoreNames []string) (VMToMismatchedPairing, error)

GetVMDatastorePairingIssues receives a list of VirtualMachines, a HostToDatastoreIndex to evaluate each VirtualMachine by, a list of all datastores and a list of datastore names which should be ignored. A VMHostDatastoresPairing index is returned noting improperly paired VirtualMachines (if any) and an error (if applicable).

NOTE: The full list of datastores is used instead of the list of datastores with specified pairing custom attribute. This is because some datastores may not have the specified custom attribute and the user may have opted to ignore any datastores or hosts which do not have it.

func (VMToMismatchedPairing) NumDatastores added in v0.29.2

func (vmtmp VMToMismatchedPairing) NumDatastores() int

NumDatastores returns the total number of datastores in the index for all recorded hosts.

func (VMToMismatchedPairing) NumHosts added in v0.29.2

func (vmtmp VMToMismatchedPairing) NumHosts() int

NumHosts returns the total number of records hosts in the index.

type VMWithBackup added in v0.29.0

type VMWithBackup struct {

	// VMWithCAs is embedded to provide access to the original
	// mo.VirtualMachine value and also access to the complete index of Custom
	// Attributes for the VM.
	VMWithCAs

	// BackupDateCAName is the name (not the value) of the Custom Attribute
	// which indicates when the last backup occurred for this VirtualMachine.
	BackupDateCAName string

	// BackupMetadataCAName is the name (not the value) of the Custom
	// Attribute which provides additional context for the last backup for
	// this VirtualMachine.
	BackupMetadataCAName string

	// BackupDate is the date/time of the last backup for this VirtualMachine.
	// If a backup date is recorded for a VM, then the time zone (aka,
	// "location") for the parsed date/time value is set to the user-specified
	// time zone. If a time zone is not specified, the default location is
	// used for a recorded backup date.
	BackupDate *time.Time

	// WarningAgeInDaysThreshold is the age in days when a recorded backup
	// date is considered stale and a WARNING threshold reached (but not yet
	// crossed).
	WarningAgeInDaysThreshold int

	// CriticalAgeInDaysThreshold is the age in days when a recorded backup
	// date is considered stale and a WARNING threshold reached (but not yet
	// crossed).
	CriticalAgeInDaysThreshold int
}

VMWithBackup is a VirtualMachine with backup date details.

func (VMWithBackup) BackupDaysAgo added in v0.29.0

func (vmwb VMWithBackup) BackupDaysAgo() int

BackupDaysAgo returns the age of a Virtual Machine's backup date in days. If a backup date is not available, 0 is returned.

func (VMWithBackup) FormattedBackupAge added in v0.29.0

func (vmwb VMWithBackup) FormattedBackupAge() string

FormattedBackupAge returns the formatted age of a Virtual Machine's backup date. If a backup is not recorded, this is indicated instead of a formatted age.

func (VMWithBackup) HasBackup added in v0.29.0

func (vmwb VMWithBackup) HasBackup() bool

HasBackup indicates whether a Virtual Machine has a user-specified Custom Attribute used to track last backup date with a non-empty value and that the BackupDate field is non-nil (assumed to be set when retrieving the last backup date for a VM).

This method does not validate the format of the Custom Attribute value, only that the requested value exists. This method does not consider whether the optional metadata Custom Attribute is present.

func (VMWithBackup) HasOldBackup added in v0.29.0

func (vmwb VMWithBackup) HasOldBackup() bool

HasOldBackup indicates whether a Virtual Machine (with a recorded backup) has a backup date which exceeds a user-specified age threshold. If a backup is not present false is returned. For best results, the caller should first filter by the HasBackup() method for the most reliable result.

func (VMWithBackup) IsCriticalState added in v0.29.0

func (vmwb VMWithBackup) IsCriticalState() bool

IsCriticalState indicates whether the CRITICAL threshold has been crossed.

A CRITICAL state is NOT if a Virtual Machine is missing a backup. Instead, the caller is expected to also validate the WARNING state which IS expected to handle that scenario.

func (VMWithBackup) IsOKState added in v0.29.0

func (vmwb VMWithBackup) IsOKState() bool

IsOKState indicates whether the WARNING or CRITICAL thresholds have been crossed.

func (VMWithBackup) IsWarningState added in v0.29.0

func (vmwb VMWithBackup) IsWarningState() bool

IsWarningState indicates whether the WARNING threshold has been crossed or if the Virtual Machine is missing a backup.

type VMWithCA added in v0.29.0

type VMWithCA struct {
	mo.VirtualMachine

	// CustomAttribute represents the name/value Custom Attribute pair as
	// specified by the user. This is often used to initially filter a
	// collection to a specific attribute (e.g., VMs with current backup
	// information) and then review further to determine whether the VM passes
	// specific criteria (e.g., backup within an expected window of time).
	CustomAttribute CustomAttribute
}

VMWithCA wraps the vSphere VirtualMachine managed object type with a specific Custom Attribute name/value pair.

func GetVMsWithCA added in v0.29.0

func GetVMsWithCA(vms []mo.VirtualMachine, vmCustomAttributeName string, ignoreMissingCA bool) ([]VMWithCA, error)

GetVMsWithCA receives a collection of VirtualMachines, a Custom Attribute name to filter VirtualMachines by and a boolean flag indicating whether VirtualMachines missing a Custom Attribute should be ignored. A collection of VMWithCA is returned along with an error (if applicable).

type VMWithCAs added in v0.29.0

type VMWithCAs struct {
	mo.VirtualMachine

	// Custom Attribute name/value index (map) of all Custom Attributes
	// associated with the managed object.
	CustomAttributes CustomAttributes
}

VMWithCAs wraps the vSphere VirtualMachine managed object type with a Custom Attribute name/value index (map) of all Custom Attributes associated with the managed object.

func FilterVMsByCustomAttributeNames added in v0.29.0

func FilterVMsByCustomAttributeNames(vmsWithCAs []VMWithCAs, caNames []string) ([]VMWithCAs, int)

FilterVMsByCustomAttributeNames searches a given collection of VMWithCAs using provided Custom Attribute names and returns a collection of VMWithCAs which have values for those Custom Attributes. Validation of Custom Attribute values is not performed. If the caller does not wish to require that a specific Custom Attribute be present, the caller should not specify the value in the given list of Custom Attribute names.

If the collection of provided VirtualMachines is empty, an empty collection is returned. The collection is returned along with the number of VirtualMachines that were excluded due to missing Custom Attribute names.

func FilterVMsByCustomAttributeStatus added in v0.29.0

func FilterVMsByCustomAttributeStatus(vms []VMWithCAs) ([]VMWithCAs, int)

FilterVMsByCustomAttributeStatus accepts a collection of VirtualMachines and evaluates whether Custom Attributes are recorded. If the collection of provided VirtualMachines is empty, an empty collection is returned. The collection is returned along with the number of VirtualMachines that were excluded due to missing Custom Attributes.

func GetVMsWithCAs added in v0.29.0

func GetVMsWithCAs(vms []mo.VirtualMachine) ([]VMWithCAs, error)

GetVMsWithCAs receives a collection of VirtualMachines and returns a collection of sorted VirtualMachines. Each VirtualMachine includes an index of Custom Attributes for that VirtualMachine. If no Custom Attributes are available, the index is empty. An error is returned if one occurs.

type VMsWithBackup added in v0.29.0

type VMsWithBackup []VMWithBackup

VMsWithBackup is a collection of VirtualMachines which track backup date details.

func GetVMsWithBackup added in v0.29.0

func GetVMsWithBackup(
	vms []mo.VirtualMachine,
	backupTimezone string,
	lastBackupCA string,
	backupMetadataCA string,
	backupDateFormat string,
	criticalAgeThreshold int,
	warningAgeThreshold int,
) (VMsWithBackup, error)

GetVMsWithBackup receives a collection of VirtualMachines, a user-specified time zone (i.e., "location"), a Custom Attribute name for the last backup (required), a Custom Attribute name for the last backup's metadata (optional), thresholds for when the backup should be considered in a CRITICAL or WARNING state and whether missing Custom Attributes should be ignored.

An error is returned if the given empty collection of VirtualMachines is empty or the user specified time zone is not recognized.

func (VMsWithBackup) AllHasBackup added in v0.29.0

func (vmswb VMsWithBackup) AllHasBackup() bool

AllHasBackup indicates whether all Virtual Machines in the collection have a last backup date.

This method does not validate the format of the last backup date value, only that the requested value exists. This method does not consider whether the optional metadata Custom Attribute is present.

func (VMsWithBackup) HasOldBackup added in v0.29.0

func (vmswb VMsWithBackup) HasOldBackup() bool

HasOldBackup indicates whether ANY of the Virtual Machines in the collection have a backup date which exceeds a user-specified age threshold. Because Virtual Machines without a recorded backup date are ignored, the caller should also use the AllHasBackup() method to first ensure that all Virtual Machines in the collection have a recorded backup.

func (VMsWithBackup) IsCriticalState added in v0.29.0

func (vmswb VMsWithBackup) IsCriticalState() bool

IsCriticalState indicates whether any Virtual Machines in the collection have crossed the CRITICAL threshold.

func (VMsWithBackup) IsOKState added in v0.29.0

func (vmswb VMsWithBackup) IsOKState() bool

IsOKState indicates whether all Virtual Machines in the collection have not crossed either of the WARNING or CRITICAL thresholds.

func (VMsWithBackup) IsWarningState added in v0.29.0

func (vmswb VMsWithBackup) IsWarningState() bool

IsWarningState indicates whether any Virtual Machines in the collection have crossed the WARNING threshold.

func (VMsWithBackup) NumBackups added in v0.29.0

func (vmswb VMsWithBackup) NumBackups() int

NumBackups returns the number of VirtualMachines in the collection which have a recorded backup via user specified Custom Attribute. This method does not validate the format of the Custom Attribute value, only that the requested value exists. This method does not consider whether the optional metadata Custom Attribute is present.

func (VMsWithBackup) NumOldBackups added in v0.29.0

func (vmswb VMsWithBackup) NumOldBackups() int

NumOldBackups returns the number of VirtualMachines in the collection which have a recorded backup via user specified Custom Attribute older than specified thresholds.

func (VMsWithBackup) NumWithoutBackups added in v0.29.0

func (vmswb VMsWithBackup) NumWithoutBackups() int

NumWithoutBackups returns the number of VirtualMachines in the collection which do not have a recorded backup via user specified Custom Attribute.

func (VMsWithBackup) VMWithOldestBackup added in v0.29.0

func (vmswb VMsWithBackup) VMWithOldestBackup() *VMWithBackup

VMWithOldestBackup returns a pointer to a Virtual Machine from the collection with the oldest backup date. Any Virtual Machine without a recorded backup date is ignored. Nil is returned if the collection is empty or if there are no backups to evaluate.

func (VMsWithBackup) VMWithYoungestBackup added in v0.29.0

func (vmswb VMsWithBackup) VMWithYoungestBackup() *VMWithBackup

VMWithYoungestBackup returns a pointer to a Virtual Machine from the collection with the most recent backup date. Any Virtual Machine without a recorded backup date is ignored. Nil is returned if the collection is empty or if there are no backups to evaluate.

type VirtualMachinePowerCycleUptimeStatus added in v0.10.0

type VirtualMachinePowerCycleUptimeStatus struct {
	VMsCritical       []mo.VirtualMachine
	VMsWarning        []mo.VirtualMachine
	VMsOK             []mo.VirtualMachine
	WarningThreshold  int
	CriticalThreshold int
}

VirtualMachinePowerCycleUptimeStatus tracks VirtualMachines with power cycle uptimes that exceed specified thresholds while retaining a list of the VirtualMachines that have yet to exceed thresholds.

func GetVMPowerCycleUptimeStatusSummary added in v0.10.0

func GetVMPowerCycleUptimeStatusSummary(
	vms []mo.VirtualMachine,
	warningThreshold int,
	criticalThreshold int,
) VirtualMachinePowerCycleUptimeStatus

GetVMPowerCycleUptimeStatusSummary accepts a list of VirtualMachines and threshold values and generates a collection of VirtualMachines that exceeds given thresholds along with those given thresholds.

func (VirtualMachinePowerCycleUptimeStatus) BottomTenOK added in v0.12.0

BottomTenOK is a helper method that returns at most ten VMs with the lowest power cycle uptime values that have yet to exceed specified thresholds. Only powered on VMs are considered.

func (VirtualMachinePowerCycleUptimeStatus) TopTenOK added in v0.11.0

TopTenOK is a helper method that returns at most ten VMs with the highest power cycle uptime values that have yet to exceed specified thresholds.

func (VirtualMachinePowerCycleUptimeStatus) VMNames added in v0.10.0

VMNames returns a list of sorted VirtualMachine names which have exceeded specified power cycle uptime thresholds. VirtualMachines which have yet to exceed specified thresholds are not listed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL