System Center 2019+ Virtual Machine Manager CPU-gebruik van bovenliggende hostpartitie

Microsoft.SystemCenter.VirtualMachineManager.HostParentPartitionCPUUtilizationMonitor (UnitMonitor)

Hiermee wordt het CPU-gebruik op de bovenliggende partitie bewaakt

Knowledge Base article:

Samenvatting

Deze monitor houdt de CPU-prestaties op de host bij. Het CPU-gebruik heeft de drempelwaarde overschreden.

Oorzaken

De werkbelastingen van de virtuele machines en bovenliggende partitie op de host verbruiken kritieke niveaus aan CPU-resources van de host.

Oplossingen

Migreer virtuele machines naar een andere host of verlaag het CPU-verbruik voor de werkbelasting op de bovenliggende partitie. U kunt de verdeling van hostclusters ook automatisch optimaliseren met Virtual Machine Manager door dynamische optimalisatie in te schakelen. Raadpleeg de documentatie bij Virtual Machine Manager voor meer informatie over dynamische optimalisatie.

Element properties:

TargetMicrosoft.SystemCenter.VirtualMachineManager.Discovery.HyperVHost
Parent MonitorSystem.Health.AvailabilityState
CategoryCustom
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SystemCenter.VirtualMachineManager.Performance.PowershellBasedConsecutiveSamplesTwoThresholdsMonitorType
RemotableTrue
AccessibilityPublic
Alert Message
CPU-gebruik van bovenliggende hostpartitiee hoog
Het CPU-gebruik op de bovenliggende partitie is {1} en heeft de niveaus Waarschuwing en Kritiek overschreden voor {0}
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.VirtualMachineManager.HostParentPartitionCPUUtilizationMonitor" Accessibility="Public" Target="VMMDiscovery!Microsoft.SystemCenter.VirtualMachineManager.Discovery.HyperVHost" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" TypeID="Microsoft.SystemCenter.VirtualMachineManager.Performance.PowershellBasedConsecutiveSamplesTwoThresholdsMonitorType">
<Category>Custom</Category>
<AlertSettings AlertMessage="Microsoft.SystemCenter.VirtualMachineManager.HostParentPartitionCPUUtilizationMonitor.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="CPUUtilizationReachedWarning" MonitorTypeStateID="ConditionWarn" HealthState="Warning"/>
<OperationalState ID="CPUUtilizationReachedError" MonitorTypeStateID="ConditionError" HealthState="Error"/>
<OperationalState ID="CPUUtilizationIsSuccess" MonitorTypeStateID="ConditionSuccess" HealthState="Success"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>180</IntervalSeconds>
<TimeoutSeconds>180</TimeoutSeconds>
<WarningThreshold>80</WarningThreshold>
<CriticalThreshold>90</CriticalThreshold>
<NumSamples>3</NumSamples>
<hostComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</hostComputerName>
<ScriptBody><Script> # This Script is used to check the Host Parent partition CPU utilization
# Alert when the utilization of this partition is high:
# Warning: WarningThreshold%, like 80%
# Critical: CriticalThreshold, like 90%
#SetLocale("en-us")
param($HostComputerName)

$momApi = new-Object -comObject "Mom.ScriptAPI"
$momBag = $momApi.CreatePropertyBag()

if ($HostComputerName -ne $null)
{
Load-CimModules

$hostName=$HostComputerName
$cimSessionOption = New-CimSessionOption -Protocol DCOM
$cimsession = New-CimSession -ComputerName $hostName -SessionOption $cimSessionOption
$itemsPerfFormattedData_Perfos_Processor = Get-CimInstance -CimSession $cimsession -ClassName "win32_PerfFormattedData_Perfos_Processor" -Namespace "root\cimv2" -Filter "Name='_Total'"
ForEach ($item in $itemsPerfFormattedData_Perfos_Processor)
{
$performanceUtilization= $item.PercentProcessorTime
}
$performanceUtilization = [int]($performanceUtilization)
$momBag.AddValue("Utilization", $performanceUtilization)
$momBag
}
else
{
$momAPI.LogScriptEvent("HostParentCPUUtilizationCounter.ps1", 101, 0, "HostParentCPUUtilizationCounter was not called with 1 argument and was not executed.")
}

Function Load-CimModules
{
$error.Clear()

$CimModule = Get-Module CimCmdlets

if ($null -eq $CimModule)
{
Import-Module CimCmdlets
$error.Clear()
}
}

</Script></ScriptBody>
<ObjectName>win32_PerfFormattedData_Perfos_Processor</ObjectName>
<CounterName>PercentProcessorTime</CounterName>
<InstanceName>_Total</InstanceName>
<Value>$Data/Property[@Name='Utilization']$</Value>
</Configuration>
</UnitMonitor>