S2D: источник данных событий WMI для действия работоспособности
Microsoft.Windows.Server.10.0.Storage.StorageSpacesDirect.WmiEventProvider.HealthActionFilterEventProvider (DataSourceModuleType)
Источник данных событий WMI для действия работоспособности.
Element properties:
Member Modules:
Overrideable Parameters:
Source Code:
<DataSourceModuleType ID="Microsoft.Windows.Server.10.0.Storage.StorageSpacesDirect.WmiEventProvider.HealthActionFilterEventProvider" Accessibility="Internal" RunAs="MicrosoftStorageLibrary!Microsoft.Storage.Library.MonitoringRunAsProfile" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TargetInstanceUniqueID" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComputerName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PollInterval" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="WQLQuery" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="PollInterval" Selector="$Config/PollInterval$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="WmiEventProviderDS" TypeID="Windows!Microsoft.Windows.WmiEventProvider">
<NameSpace>\\$Config/ComputerName$\root\Microsoft\Windows\Storage</NameSpace>
<Query>$Config/WQLQuery$</Query>
<PollInterval>$Config/PollInterval$</PollInterval>
</DataSource>
<ProbeAction ID="PA" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
<ScriptName>StorageOngoingJobsEventProbe.ps1</ScriptName>
<ScriptBody><Script>
Param($SourceUniqueId, $SourceObjectId, $HealthActionId, $Reason, $Description, $Status, $PercentComplete)
#general variables
#-----------------
$errorActionPreference = 'Stop'
$errEvent = [System.Diagnostics.EventLogEntryType]::Error;
$infoEvent = [System.Diagnostics.EventLogEntryType]::Information;
$GenericInformationEvent = 8671;
$GenericFailureEvent = 8672;
$script:traceMsg = "";
$msft_namespace = "root\microsoft\windows\storage"
$cluster_namespace = "root\mscluster"
$momAPI = New-Object -comObject 'MOM.ScriptAPI'
Function AddTraceMessage
{
param($message)
$errorActionPreference = 'SilentlyContinue'
$timeStamp = (get-date -format "HH:mm:ss:fff");
$script:traceMsg = $script:traceMsg + "`n[" + $timeStamp + "] " + $message;
}
AddTraceMessage -message "Start on Node: $env:COMPUTERNAME"
#Param($SourceUniqueId, $SourceObjectId, $HealthActionId, $Reason, $Description, $Status, $PercentComplete)
#general variables
$scriptName = "WMIJobPropertyBagMapperScript.ps1"
Try
{
AddTraceMessage -message "Triggered script"
AddTraceMessage -message $SourceUniqueId
AddTraceMessage -message $HealthActionId
AddTraceMessage -message $SourceObjectId
$bag = $momAPI.CreatePropertyBag()
$bag.AddValue("SourceUniqueId", $SourceUniqueId)
$bag.AddValue("SourceObjectId", $SourceObjectId)
$bag.AddValue("HealthActionId", $HealthActionId)
$bag.AddValue("Reason", $Reason)
$bag.AddValue("Description", $Description)
$bag.AddValue("Status", $Status)
$bag.AddValue("PercentComplete", $PercentComplete)
$bag.AddValue("CompositeJobId", $HealthActionId + ":" + $SourceObjectId);
$bag
}
Catch
{
AddTraceMessage -message $_.Exception.Message
}
Finally
{
if ($error -ne $null -and $error.Count -gt 0 -and $error[0] -ne $null)
{
$momAPI.LogScriptEvent($scriptName, $GenericFailureEvent, 1, $error[0].ToString());
}
#Logging
if ($script:traceMsg -ne $null)
{
#Debug event
$momAPI.LogScriptEvent($scriptName, $GenericInformationEvent, 0, $script:traceMsg);
}
}</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>SourceUniqueId</Name>
<Value>$Config/TargetInstanceUniqueID$</Value>
</Parameter>
<Parameter>
<Name>SourceObjectId</Name>
<Value>$Data/Property[@Name='SourceObjectId']$</Value>
</Parameter>
<Parameter>
<Name>HealthActionId</Name>
<Value>$Data/Property[@Name='HealthActionId']$</Value>
</Parameter>
<Parameter>
<Name>Reason</Name>
<Value>$Data/Property[@Name='Reason']$</Value>
</Parameter>
<Parameter>
<Name>Description</Name>
<Value>$Data/Property[@Name='Description']$</Value>
</Parameter>
<Parameter>
<Name>Status</Name>
<Value>$Data/Property[@Name='Status']$</Value>
</Parameter>
<Parameter>
<Name>PercentComplete</Name>
<Value>$Data/Property[@Name='PercentComplete']$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</ProbeAction>
<ConditionDetection ID="CD" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='SourceUniqueId']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Config/TargetInstanceUniqueID$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<Composition>
<Node ID="CD">
<Node ID="PA">
<Node ID="WmiEventProviderDS"/>
</Node>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>