System Center 2019+ Virtual Machine Manager Host Memory Utilization

Microsoft.SystemCenter.VirtualMachineManager.HostMemoryUtilizationMonitor (UnitMonitor)

Monitors the host memory utilization

Knowledge Base article:

Summary

This monitor tracks how much memory on the host is being used, in megabytes. The available memory for the host is less than the threshold.

Causes

The virtual machines running on the host are consuming critical levels of host memory.

Resolutions

To free additional host memory, migrate a virtual machine to another host. To have Virtual Machine Manager automatically load-balance host clusters, enable the dynamic optimization feature. For information about dynamic optimization, see the Virtual Machine Manager documentation.

Element properties:

TargetMicrosoft.SystemCenter.VirtualMachineManager.Discovery.HyperVHost
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SystemCenter.VirtualMachineManager.Performance.PowershellBasedConsecutiveSamplesTwoThresholdsMonitorType
RemotableTrue
AccessibilityPublic
Alert Message
Host Memory Utilization is high
Host memory utilization is {1} and has exceeded the warning or critical levels for {0}
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.VirtualMachineManager.HostMemoryUtilizationMonitor" Accessibility="Public" Target="VMMDiscovery!Microsoft.SystemCenter.VirtualMachineManager.Discovery.HyperVHost" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" TypeID="Microsoft.SystemCenter.VirtualMachineManager.Performance.PowershellBasedConsecutiveSamplesTwoThresholdsMonitorType">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SystemCenter.VirtualMachineManager.HostMemoryUtilizationMonitor.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter1>
<AlertParameter2>$Data/Context/SampleValue$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="MemoryUtilizationReachedWarning" MonitorTypeStateID="ConditionWarn" HealthState="Warning"/>
<OperationalState ID="MemoryUtilizationReachedError" MonitorTypeStateID="ConditionError" HealthState="Error"/>
<OperationalState ID="MemoryUtilizationIsSuccess" MonitorTypeStateID="ConditionSuccess" HealthState="Success"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>180</IntervalSeconds>
<TimeoutSeconds>180</TimeoutSeconds>
<WarningThreshold>90</WarningThreshold>
<CriticalThreshold>95</CriticalThreshold>
<NumSamples>3</NumSamples>
<hostComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</hostComputerName>
<ScriptBody><Script># Copyright (c) Microsoft Corporation. All rights reserved.
# Powershell source code
# HostMemoryUtilizationCounter.ps1

# This Script is used to check the Host memory utilization
# Alert when the utilization of this partition is high:
# Warning: WarningThreshold%, like 80%
# Critical: CriticalThreshold, like 90%

param($hostComputerName)

$momAPI = new-object -comObject MOM.ScriptAPI
$error.Clear();
$oBag = $momAPI.CreatePropertyBag();

$colItems = gcim Win32_OperatingSystem;

foreach($objItem in $colItems){
if($objItem.TotalVisibleMemorySize -gt 0){
$performanceUtilization = (($objItem.TotalVisibleMemorySize - $objItem.FreePhysicalMemory)/$objItem.TotalVisibleMemorySize)*100;
}
}

if($performanceUtilization -lt 0){
$performanceUtilization = 0;
}

$performanceUtilization = [int]$performanceUtilization;

$oBag.AddValue("Utilization",$performanceUtilization);
$oBag;</Script></ScriptBody>
<ObjectName>win32_PerfFormattedData_Perfos_Memory</ObjectName>
<CounterName>PercentCommittedBytesInUse</CounterName>
<InstanceName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</InstanceName>
<Value>$Data/Property[@Name='Utilization']$</Value>
</Configuration>
</UnitMonitor>