MSSQL on Windows: Automatic setup of DB Engine Discovery filter

Microsoft.SQLServer.Windows.LocalDBEngineDiscoveryFilterSetup (Rule)

This rule automatically disables monitoring of non-version agnostic management packs for SQL Server 2012, 2014, and 2016.

Knowledge Base article:

Summary

This rule runs after importing the version-agnostic management pack for SQL Server. The rule checks whether you have any of the version-specific management packs for SQL Server in your Operations Manager, and creates a list of SQL DB engines being monitored by these packs. Then, in the version-agnostic management pack, the rule creates an override that disables monitoring of the SQL DB engines taken from the created list. After the SQL DB engines are disabled in the version-agnostic management pack, the rule disables itself. Such behavior helps avoid double-monitoring that would otherwise be performed by both version-agnostic and version-specific management packs at the same time. You can re-enable this rule manually at any time. Note that this rule throws an alert in cases when the SCOM SDK RunAs account that you use does not have necessary permissions.

Element properties:

TargetMicrosoft.SQLServer.Windows.SqlVersionAgnosticGroup
CategoryMaintenance
EnabledTrue
Alert GenerateFalse
RemotableTrue

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.SQLServer.Windows.DataSource.SqlMpDiscoveryDataSource Default
WA1 WriteAction Microsoft.SQLServer.Windows.WriteAction.WriteOverrideWithAlert Default
WA2 WriteAction Microsoft.SQLServer.Windows.WriteAction.WriteOverrideWithAlert Default

Source Code:

<Rule ID="Microsoft.SQLServer.Windows.LocalDBEngineDiscoveryFilterSetup" Target="Microsoft.SQLServer.Windows.SqlVersionAgnosticGroup" Enabled="true" ConfirmDelivery="false">
<Category>Maintenance</Category>
<DataSources>
<DataSource ID="DS" TypeID="Microsoft.SQLServer.Windows.DataSource.SqlMpDiscoveryDataSource">
<IntervalSeconds>3600</IntervalSeconds>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WA1" TypeID="Microsoft.SQLServer.Windows.WriteAction.WriteOverrideWithAlert">
<ManagementGroupName>$Target/ManagementGroup/Name$</ManagementGroupName>
<TargetElementId>$MPElement[Name="Microsoft.SQLServer.Windows.LocalDBEngineDiscovery"]$</TargetElementId>
<TargetModuleName>DS</TargetModuleName>
<TargetParameterName>ExcludedVersions</TargetParameterName>
<OverrideCategory>Configuration</OverrideCategory>
<OverrideValue>$Data//Property[@Name='VersionList']$</OverrideValue>
<OverrideName>Microsoft.SQLServer.Windows.DiscoveryOverride.LocalDBEngineDiscovery</OverrideName>
<OverrideDisplayName>Disable discovery of selected DB Engines</OverrideDisplayName>
<Publisher>SQLDiscoveryWindows</Publisher>
<AlertMessage>Disable discovery of selected DB Engines</AlertMessage>
<AlertPriority>1</AlertPriority>
<AlertSeverity>1</AlertSeverity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.Windows.WriteAction.WriteOverrideWithAlert.AlertMessage"]$</AlertMessageId>
</WriteAction>
<WriteAction ID="WA2" TypeID="Microsoft.SQLServer.Windows.WriteAction.WriteOverrideWithAlert">
<ManagementGroupName>$Target/ManagementGroup/Name$</ManagementGroupName>
<TargetElementId>$MPElement[Name="Microsoft.SQLServer.Windows.LocalDBEngineDiscoveryFilterSetup"]$</TargetElementId>
<TargetParameterName>Enabled</TargetParameterName>
<OverrideCategory>Property</OverrideCategory>
<OverrideValue>false</OverrideValue>
<OverrideName>Microsoft.SQLServer.Windows.RuleOverride.LocalDBEngineDiscoveryFilterSetup</OverrideName>
<OverrideDisplayName>Disable filter autosetup rule</OverrideDisplayName>
<Publisher>SQLDiscoveryWindows</Publisher>
<AlertMessage>Disable filter autosetup rule</AlertMessage>
<AlertPriority>1</AlertPriority>
<AlertSeverity>1</AlertSeverity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.Windows.WriteAction.WriteOverrideWithAlert.AlertMessage"]$</AlertMessageId>
</WriteAction>
</WriteActions>
</Rule>