Visual Studio Management Pack Authoring Series - Part 4 - Create an Instance Group (class and discovery)

Three key groups I will create are:

  • Group of “instances” of the Application. This is a group of the application server class.

  • Computer Objects for the Application. This is a group of computer objects of computers hosting the application server class.

  • Health Service Watcher Objects for the Application (this is also an instance group). The Health Service Heartbeat failure and Failed to Connect to Computer monitors are targeted at this class. If you want notifications from these alerts, then you need to scope the notification subscription to the appropriate Health Service Watcher Group.

  • There is also a fourth that we will look at later for Distributed Applications. But we'll cover that separately!

Lets do the first one - A group of instances of the application

Right Click GroupClassAndDiscovery and choose Add, New Item 

Add Empty Management Pack Fragment and choose a name of GDMyAppInstanceGroup

Copy and Paste this code between the <ManagementPackFragment></ManagementPackFragment> tags

You'll need to do a find \ replace for 2 items. The first changes the class namespace for the application class and discovery. The second changes the Display Name. 

1. Class Namespace and Discovery

Find What: GD.Application

Replace With: GD.MyApp

2. Display Name

Find What: GD Application Server

Replace With: GD My App Server

If you try to build the project, it will fail as the creation of Instance Groups requires a reference to the Microsoft.SystemCenter.InstanceGroup.Library.MP which doesn't exist by default when you create a new project. So ...

1. Right Click References and choose Add Reference

2. Browse to C:\Program Files (x86)\System Center 2012 Visual Studio Authoring Extensions\References\OM2012R2

3. Select Microsoft.SystemCenter.InstanceGroup.Library.MP

We should now be able to test this:

1. Build the Project and make sure it builds successfully.

2. Click Start to export the Management Pack to the default Management Group

3. Go to Authoring, Groups and check out the Group Members

Disclaimer:
All information on this blog is provided on an as-is basis with no warranties and for informational purposes only. Use at your own risk.

The opinions and views expressed in this blog are those of the author and do not necessarily state or reflect those of my employer.

Comments

  • Anonymous
    August 25, 2015
    As promised, here is a run through of authoring Management Packs using Visual Studio and the Operations