Disabling a Specific Category of Rules in a SCOM 2012/2016 Management Pack

Recently I wrote up a post about disabling Rules (and followed that up with Monitors and Discoveries)…but I  was asked if it’s possible to only disable a specific category of rules. For example you might want to disable all alerting rules or disable performance collection rules, or maybe event collection rules. Whatever your desire, yes it can be done. Let me show you how!

So by my count there are 18 different types of rules:

  • Alert
  • AvailabilityHealth
  • ConfigurationHealth
  • ConnectorFramework
  • Custom
  • Discovery
  • DSIntegration
  • EventCollection
  • ExceptionMonitoring
  • Maintenance
  • Notification
  • Operations
  • PerformanceCollection
  • PerformanceHealth
  • SecurityHealth
  • SoftwareAndUpdates
  • StateCollection
  • System

 

Like with my previous posts it’s a very easy process to follow…

Step 1…Create a blank unsealed MP to store the overrides in. Once you’ve created your Overrides MP, just note down the name.

 

microsoft-sqlserver-monitoring-overrides

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 2…Change lines 1 and 2 to the names of the MP you wish to disable the Monitors in and the overrides MP you wish to save the overrides to and line 4 is where you’ll choose which ‘category’ of rule you wish to disable.

Step 3…Run the script!

 

# Disable Specific Rules in a Sealed MP to an Unsealed Overrides MP

# This example deletes all “PerformanceCollection” Rules
# Valid Categories are: Alert, AvailabilityHealth, ConfigurationHealth, ConnectorFramework, Custom,
# Discovery, DSIntegration, EventCollection, ExceptionMonitoring, Maintenance, Notification,
# Operations, PerformanceCollection, PerformanceHealth, SecurityHealth, SoftwareAndUpdates
# StateCollection, System

$mp = Get-SCOMManagementPack | ? {$_.Name -eq “Microsoft.SQLServer.2012.Monitoring“}
$overridesmp = Get-SCOMManagementPack | ? {$_.Name -eq “Microsoft.SQLServer.Monitoring.Overrides“}
$Rules = Get-SCOMRule -ManagementPack $mp
$PerfRules = $Rules | ? {$_.Category -eq “PerformanceCollection“}
Disable-SCOMRule -Rule $PerfRules -ManagementPack $overridesmp

 

Depending on the number of Rules in this Management Pack you can expect this to take a few minutes…

And again you can ‘enable’ these Rules by changing the last line to “Enable-SCOMRule”.

 

 

 
Comments

No comments yet.

Leave a Reply