MSSQL в Windows: источник данных для целевого обнаружения локальной коллекции предупреждений
Microsoft.SQLServer.Windows.DataSource.LocalAlertCollectionDiscovery (DataSourceModuleType)
Источник данных SQL Server для целевого локального сбора предупреждений в Windows
Element properties:
Member Modules:
Overrideable Parameters:
Source Code:
<DataSourceModuleType ID="Microsoft.SQLServer.Windows.DataSource.LocalAlertCollectionDiscovery" Accessibility="Public" RunAs="SqlCoreLib!Microsoft.SQLServer.Core.RunAs.Discovery">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PrincipalName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DisplayName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MonitoringPoolClassId" type="xsd:string"/>
<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:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SyncTime" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" ParameterType="int" Selector="$Config/IntervalSeconds$"/>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
<OverrideableParameter ID="SyncTime" ParameterType="string" Selector="$Config/SyncTime$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.Discovery.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval Unit="Seconds">$Config/IntervalSeconds$</Interval>
<SyncTime>$Config/SyncTime$</SyncTime>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="Script" TypeID="Windows!Microsoft.Windows.PowerShellDiscoveryProbe">
<ScriptName>DiscoverLocalMonitoringPoolAlertCollection.ps1</ScriptName>
<ScriptBody><Script>param($principalName, $MapElement, $TargetID, $monitoringPoolClassId, $displayName)
$ErrorActionPreference = 'Stop'
$api = New-Object -ComObject "MOM.ScriptAPI"
$discoveryData = $api.CreateDiscoveryData(0, $MapElement, $TargetID)
$computerNameData = Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters' -ErrorAction Stop
$discoveredName = $computerNameData.Hostname
if(![string]::IsNullOrEmpty($computerNameData.Domain)){
$discoveredName = "$($computerNameData.Hostname).$($computerNameData.Domain)"
}
if($principalName -eq $discoveredName){
$targetObj = $discoveryData.CreateClassInstance("$monitoringPoolClassId")
$targetObj.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $principalName)
$targetObj.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "$displayName ($principalName)")
$discoveryData.AddInstance($targetObj)
}
$discoveryData</Script></ScriptBody>
<SnapIns/>
<Parameters>
<Parameter>
<Name>MapElement</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>TargetID</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>PrincipalName</Name>
<Value>$Config/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>MonitoringPoolClassId</Name>
<Value>$Config/MonitoringPoolClassId$</Value>
</Parameter>
<Parameter>
<Name>DisplayName</Name>
<Value>$Config/DisplayName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="Script">
<Node ID="DS"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>