MP UPDATE: The updated MP for all sql versions plus new explainations can be found at http://blogs.technet.com/b/emreguclu/archive/2014/09/12/undiscovering-stop-monitoring-sql-2005-2008-2012-express-editions.aspx
In this post I will try to cover an alternate method of undiscovering SQL Express editions other than using the ExcludeList Property where I have a decent reason to do so. The MP explained in detail is also attached to the post so that you can test an deploy.
Even though SQL MP has ExcludeList override property for “Discover SQL Server 2008 Database Engines (Windows Server)” this property requires manually specifying Instance Names in format of (SQLExpress;MICROSOFT##SSEE). Therefore if a 3rd party application using instance name other than the default ones SCOM Admin has to know the name and exclude it manually for the discovery. This method is very well documented in Kevins Blog.
My method is a bit more complex but more dynamic so that SCOM Admin has almost nothing else to do. For the ones who are not interested how this method works ,they can use the MP attached in this blog of course after testing and reading How to Use The MP section.
The High Level Logic;
- Create a custom seed class whose base class is Microsoft.SQLServer.2008.Seed
- Discover this custom class and add property of Edition using a wmi query through Microsoft.Windows.Discovery.WMISinglePropertyProvider2
- Create a custom Group of Computers which contains the Custom Seed Class
- Discover the Members of the Group
- Disable the DB Engine Discovery in SQL MP through an Override for our Custom Group
- Remove disabled instances
With the above logic you will be able stop discovering SQL DB Engines on the Computers where SQL Express editions is installed.
I am sure you are wondering what will happen to the group (in step 3 above) once the instances are removed (step 6). This a question I got from my friends that “wont the group be emptied once the instances are deleted??” The answer is a big “NO”. That’s why I created a custom seed class taking the SQL seed class as the base class which is upper than the DB engines (DB engines will be removed not the seed) in the hierarchy. I also added the edition property to my seed class (please check step 2 details below in MP Explained) so that I can group filtering the seeds of express editions.
- if a computer has SQL express edition plus the Standard or Enterprise edition all of them will be undiscovered (but I guess this is a very minor case but just wanted to point out if you have such configurations).
- the discovery for the seed class has an interval of one hour (it will be ok in terms of performance since this is a basic wmi discovery). If SQL DB Engine discovery runs before our seed class discovcery than the sql express edition will be discovered. This is not going to happen frequently but once a month running Remove-SCOMDisabledClassInstance would do the trick
Extending Windows Computer Class using VSAE; I wont be starting from scratch to mp Authoring but this post will do fine for the ones who want to adapt to Visual Studio Authoring.
1) Create a custom seed class; First we need to declare our seed class which is based on the seed class in SQL MP.
<ClassType ID="SQLExpress.RemoveMP.SQLSeed.Class" Base="MS2D!Microsoft.SQLServer.2008.Seed" Accessibility="Public" Abstract="false" Hosted="true" Singleton="false" Extension="false">
2) Discover this custom class; The edition string (PropertyStrValue) exists in WMI of the SQL Server computer under Root\Microsoft\SQLServer\ComputerManagement10 Namespace on SqlServiceAdvancedProperty. to discover this property I used Microsoft.Windows.Discovery.WMISinglePropertyProvider2 Data Source (documented here)
<Discovery ID="SQLExpress.RemoveMP.SQLSeed.Class.Discovery" Comment="Discovers SQL Edition Seeds" Target="MS2D!Microsoft.SQLServer.2008.Seed" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">
Once the above discovery works you will notice this custom seed class instances in Discovered Inventory.
3. Create a custom Group; Creating a custom group is easy we just first need to declare the class like any other classes but use the Microsoft.SystemCenter.InstanceGroup class as the base class and chance the class type to Singleton.
|<ClassType ID="SQLExpress.RemoveMP.SQL.Express.Group" Accessibility="Public" Abstract="false" Base="SCIGL!Microsoft.SystemCenter.InstanceGroup" Hosted="false" Singleton="true" />|
4. Discover the Members; We will use GroupPopulator like in all other group membership discoveries but will utilize the <Contains> expression documented here and sample mps here. This discovery will populate the Microsoft.Windows.Computer instances which contains our custom seed class (step 1 – SQLExpress.RemoveMP.SQLSeed.Class)
<Discovery ID="SQLExpress.RemoveMP.SQL.Express.Group.Discovery" Enabled="true" Target="SQLExpress.RemoveMP.SQL.Express.Group" ConfirmDelivery="true" Remotable="true" Priority="Normal">
5. Disable the DB Engine Discovery; This is just an override to DB Engine Discovery for our class created in step 3 (SQLExpress.RemoveMP.SQL.Express.Group).
The whole MP is attached to this post so that you can also see the references, displaystrings how the mp comes together.
6. Remove disabled instances; just run the Remove-SCOMDisabledClassInstance command on OpsMgr Shell
How to use the MP
- Import the mp (like in all other mps)
- Wait till you get the mp active in your sql agents and you notice the seed class is populated (check the screenshot in step 2 of MP explained section above) and also you will see the members populated for the group in powershell. Once you verify you can proceed with the next step.
- Open SCOM Powershell console and run the following command.
1) Stop monitoring SQL Express and Windows Internal Database
3) ExpressionType (GroupPopulationSchema)
4) Creating a Group of Windows Computer and Health Service Watcher Objects