System Center 2016 Virtual Machine Manager 主机父分区 CPU 使用率

Microsoft.SystemCenter.VirtualMachineManager.2016.HostParentPartitionCPUUtilizationMonitor (UnitMonitor)

监视父分区上的 CPU 使用率

Knowledge Base article:

摘要

此监视器跟踪主机的 CPU 性能。CPU 使用率已超过阈值。

原因

主机上运行的虚拟机和父分区工作负荷所消耗的主机 CPU 资源已达到严重级别。

解决方法

将虚拟机迁移到其他主机,或者减小父分区工作负荷 CPU 消耗。要让 Virtual Machine Manager 自动平衡主机群集,请启用动态优化。有关动态优化的详细信息,请参阅 Virtual Machine Manager 文档。

Element properties:

TargetMicrosoft.SystemCenter.VirtualMachineManager.2016.HyperVHost
Parent MonitorSystem.Health.AvailabilityState
CategoryCustom
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SystemCenter.VirtualMachineManager.2016.Performance.PowershellBasedConsecutiveSamplesTwoThresholdsMonitorType
RemotableTrue
AccessibilityPublic
Alert Message
主机父分区 CPU 使用率高
父分区 CPU 使用率为 {1} 并且已经超出 {0} 的警告或严重级别
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.VirtualMachineManager.2016.HostParentPartitionCPUUtilizationMonitor" Accessibility="Public" Target="VMM2016Discovery!Microsoft.SystemCenter.VirtualMachineManager.2016.HyperVHost" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" TypeID="Microsoft.SystemCenter.VirtualMachineManager.2016.Performance.PowershellBasedConsecutiveSamplesTwoThresholdsMonitorType">
<Category>Custom</Category>
<AlertSettings AlertMessage="Microsoft.SystemCenter.VirtualMachineManager.2016.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)
{
$hostName=$HostComputerName
$itemsPerfFormattedData_Perfos_Processor = Get-CimInstance -ClassName "win32_PerfFormattedData_Perfos_Processor" -Namespace "root\cimv2" -ComputerName $hostName -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.")
}

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