Disabling all Monitors in a SCOM 2012/2016 Management Pack

A couple of days ago I wrote a quick post about disabling rules in a SCOM Management Pack. Well I figured I had better do the same thing for Monitors. Like with our rules, disabling Monitors can be done manually (yeah nah) or using PowerShell. Again we’ll use PowerShell.

If you’re planning on disabling monitors then you’ll need to override them, essentially changing them to enabled=false… So like with my post about Rules, I’ll assume you have a sealed MP…again we’ll work with the SQL Server 2012 one…and you want to turn off all monitors. So we’ll use the “Microsoft.SQLServer.2012.Monitoring” Management Pack.

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.

Step 3…Run the script!

# Disable all Monitors in a Sealed MP to an Unsealed Overrides MP

$mp = Get-SCOMManagementPack | ? {$_.Name -eq “Microsoft.SQLServer.2012.Monitoring“}
$overridesmp = Get-SCOMManagementPack | ? {$_.Name -eq “Microsoft.SQLServer.Monitoring.Overrides“}
$Monitors = Get-SCOMMonitor -ManagementPack $mp
Disable-SCOMMonitor -Monitor $Monitors -ManagementPack $overridesmp

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

And that’s it! When you open the Overrides MP you’ll see plenty of overrides in there, and all Monitors will be turned off…all done scriptomatically of course!

And if you want to do the reverse…you can ‘enable’ all Monitors by changing the last line to “Enable-SCOMMonitor”.

 
Comments

No comments yet.

Leave a Reply