Monitora a utilização de CPU do host
Esse monitor rastreia o desempenho de CPU do host. A utilização de CPU excedeu o limite.
As máquinas virtuais em execução no host estão consumindo níveis críticos dos recursos de CPU no host.
Para liberar recursos de CPU, faça a migração de uma máquina virtual para outro host. Também é possível fazer com que o Virtual Machine Manager otimize clusters de hosts automaticamente, habilitando a Otimização Dinâmica. Para obter informações sobre a Otimização Dinâmica, consulte a documentação do Virtual Machine Manager.
Target | Microsoft.SystemCenter.VirtualMachineManager.2012.HyperVHost | ||
Parent Monitor | System.Health.AvailabilityState | ||
Category | AvailabilityHealth | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | MatchMonitorHealth | ||
Alert Priority | Normal | ||
Alert Auto Resolve | True | ||
Monitor Type | Microsoft.SystemCenter.VirtualMachineManager.2012.Performance.ScriptBasedConsecutiveSamplesTwoThresholdsMonitorType | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default |
<UnitMonitor ID="Microsoft.SystemCenter.VirtualMachineManager.2012.HostCPUUtilizationMonitor" Accessibility="Public" Target="VMM2012Discovery!Microsoft.SystemCenter.VirtualMachineManager.2012.HyperVHost" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" TypeID="Microsoft.SystemCenter.VirtualMachineManager.2012.Performance.ScriptBasedConsecutiveSamplesTwoThresholdsMonitorType">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SystemCenter.VirtualMachineManager.2012.HostCPUUtilizationMonitor.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="HostCPUUtilizationReachedWarning" MonitorTypeStateID="ConditionWarn" HealthState="Warning"/>
<OperationalState ID="HostCPUUtilizationReachedError" MonitorTypeStateID="ConditionError" HealthState="Error"/>
<OperationalState ID="HostCPUUtilizationIsSuccess" MonitorTypeStateID="ConditionSuccess" HealthState="Success"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>180</IntervalSeconds>
<TimeoutSeconds>180</TimeoutSeconds>
<WarningThreshold>80</WarningThreshold>
<CriticalThreshold>90</CriticalThreshold>
<NumSamples>3</NumSamples>
<Arguments/>
<ScriptBody>
' Copyright (c) Microsoft Corporation. All rights reserved.
' VBScript source code
' HostCPUUtilizationProvider.vbs
Option Explicit
SetLocale("en-us")
' This Script is used to check the Host CPU utilization
' which includes parent partition and CPU utilizations caused by the vms
' Alert when the utilization of this partition is high:
' Warning: WarningThreshold%, like 80%
' Critical: CriticalThreshold, like 90%
Dim oAPI, oBag, oArgs, hostComputerName
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oArgs = Wscript.Arguments
Set oBag= oAPI.CreatePropertyBag()
Dim TimePeriodMiliSeconds, strQuery, strLPCountQuery, objWMIService, colItems, sleepTime, objItem
TimePeriodMiliSeconds = 10 * 1000
strQuery = "SELECT * FROM Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor where Name='_Total'"
strLPCountQuery = "SELECT * FROM Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor"
Dim F, T1 , P1 , T2 , P2 , CPU
Set objWMIService = GetObject("winmgmts:\\localhost\root\CIMV2")
'Get the LP Count
Set colItems = objWMIService.ExecQuery(strLPCountQuery,,48)
Dim LPCount
LPCount = -1
For Each objItem in colItems
LPCount = LPCount + 1
Next
if LPCount < 1 then
WScript.quit 1
end if
'Take 2 readings
Set colItems = objWMIService.ExecQuery(strQuery,,48)
For Each objItem in colItems
T1 = objItem.PercentTotalRunTime
P1 = objItem.Timestamp_PerfTime
Next
Wscript.Sleep(TimePeriodMiliSeconds)
Set colItems = objWMIService.ExecQuery(strQuery,,48)
For Each objItem in colItems
F = objItem.Frequency_PerfTime
T2 = objItem.PercentTotalRunTime
P2 = objItem.Timestamp_PerfTime
Next
If P2 - P1 = 0 Then
Call oAPI.LogScriptEvent("HostCPUUtilizationCounter.vbs", 101, 0, "HostCPUUtilizationCounter.vbs was not called with 1 argument and was not executed.")
Wscript.quit 1
End If
'Calculate CPU readings with formula
CPU = (T2 - T1) / ( P2 - P1)
CPU = (F * CPU) / LPCount
CPU = Int(CPU / 100000)
if CPU > 100 then
CPU = 100
end if
if CPU < 0 then
CPU = 0
end if
CPU = CInt(CPU)
call oBag.AddValue("Utilization", CPU)
Call oAPI.Return(oBag)
</ScriptBody>
<ObjectName>Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor</ObjectName>
<CounterName>PercentTotalRunTime</CounterName>
<InstanceName>_Total</InstanceName>
<Value>$Data/Property[@Name='Utilization']$</Value>
</Configuration>
</UnitMonitor>