System Center 2016 Virtual Machine Manager Hyper-V 호스트 업데이트 유닛 모니터 유형

Microsoft.SystemCenter.VirtualMachineManager.2016.HyperVHostUpdateMonitorType (UnitMonitorType)

이 모니터 유형은 가상화 호스트 업데이트의 상태를 검색하는 데 사용됩니다.

Element properties:

RunAsDefault
AccessibilityPublic
Support Monitor RecalculateFalse

Member Modules:

ID Module Type TypeId RunAs 
DataSource DataSource Microsoft.Windows.TimedScript.PropertyBagProvider Default
ErrorFilter ConditionDetection System.ExpressionFilter Default
SuccessFilter ConditionDetection System.ExpressionFilter Default

Overrideable Parameters:

IDParameterTypeSelector
IntervalSecondsint$Config/IntervalSeconds$
TimeoutSecondsint$Config/TimeoutSeconds$
FileNamestring$Config/FileName$
ParentPathstring$Config/ParentPath$
ExpectedVersionstring$Config/ExpectedVersion$

Source Code:

<UnitMonitorType ID="Microsoft.SystemCenter.VirtualMachineManager.2016.HyperVHostUpdateMonitorType" Accessibility="Public">
<MonitorTypeStates>
<MonitorTypeState ID="Error"/>
<MonitorTypeState ID="Success"/>
</MonitorTypeStates>
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
<SchemaType>System!System.CommandExecuterSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="FileName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ParentPath" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ExpectedVersion" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="FileName" Selector="$Config/FileName$" ParameterType="string"/>
<OverrideableParameter ID="ParentPath" Selector="$Config/ParentPath$" ParameterType="string"/>
<OverrideableParameter ID="ExpectedVersion" Selector="$Config/ExpectedVersion$" ParameterType="string"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="DataSource" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime/>
<ScriptName>HyperVHostUpdateMonitor.vbs</ScriptName>
<Arguments>$Config/FileName$ $Config/ParentPath$ $Config/ExpectedVersion$</Arguments>
<ScriptBody><Script>' Copyright (c) Microsoft Corporation. All rights reserved.
' VBScript source code
' HyperVHostUpdateMonitor.vbs
Option Explicit

SetLocale("en-us")

' This Script is used to check if the specified file's version is greater than or equal to expectedversion
' If the actual version is greater than expected one, then output Healthy
' Otherwise output UnHealthy

Dim oArgs, oBag, oAPI, objFSO, actualVersion, fileName, parentPath, expectedValue
Set oAPI = CreateObject("MOM.ScriptAPI")

' There are 3 arguments, they are the following values.
' (1) FileName
' (2) ParentPath
' (3) ExpectedVersion
Set oArgs = Wscript.Arguments


' Check to see if the required script arguments are there
' 3 argument are requried
' If 3 argument do not exist, log a script event
If oArgs.Count = 3 Then
Set oBag = oAPI.CreatePropertyBag()

fileName = oArgs(0)
parentPath = oArgs(1)
expectedValue = oArgs(2)

Set objFSO = CreateObject("Scripting.FileSystemObject")

Call oBag.AddValue("ParentPath", parentPath)
Call oBag.AddValue("ExpectedFile", fileName)

' Check if the ParentPath is present
if objFSO.FolderExists(parentPath) Then
Call oBag.AddValue("parentPath Exists", "Yes")

' Check if the speicified file is present
if objFSO.FileExists(parentPath&amp; "\" &amp;fileName) Then
Call oBag.AddValue("Expected File Exists", "Yes")
' Get the version of the specified file
actualVersion = objFSO.GetFileVersion(parentPath&amp; "\" &amp;fileName)
if actualVersion &lt; expectedValue Then
Call oBag.AddValue("Update Installed", "UnHealthy")
else
Call oBag.AddValue("Update Installed", "Healthy")
End if

Call oBag.AddValue("ActualVersion", actualVersion)
Call oBag.AddValue("ExpectedVersion", expectedValue)
Else
Call oBag.AddValue("Expected File Exists", "No")
Call oBag.AddValue("Update Installed", "UnHealthy")
End If
Else
' If the parentpath is absent, output UnHealthy
Call oBag.AddValue("parentPath Exists", "No")
Call oBag.AddValue("Update Installed", "UnHealthy")
End If

Call oAPI.Return(oBag)
Else
Call oAPI.LogScriptEvent("HyperVHostUpdateMonitor.vbs", 101, 0, "HyperVHostUpdateMonitor was not called with 3 argument and was not executed.")
End If </Script></ScriptBody>
<SecureInput/>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<EventPolicy/>
</DataSource>
<ConditionDetection ID="ErrorFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Update Installed']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">UnHealthy</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="SuccessFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Update Installed']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Healthy</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="Error">
<Node ID="ErrorFilter">
<Node ID="DataSource"/>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Success">
<Node ID="SuccessFilter">
<Node ID="DataSource"/>
</Node>
</RegularDetection>
</RegularDetections>
</MonitorImplementation>
</UnitMonitorType>