I recently posted an walk-thru about how to create a computer group, so I figured a demonstration on how to create an instance group was in order.
I mentioned that it is a best practice to create at least one computer group in your management pack in that first article, and gave a couple reasons why. The same considerations hold true for instance groups.
Computer group and Instance group considerations
Whenever we have instances of objects that are in common (of the same type), consider creating a group of these instances. The main reason for this is two-fold.
1. The customer might want to override a monitor on a global scale for all objects of the same type. Grouping instances of the same type enables the customer to do this easily, without having to create the group in their override management pack. Note that this is more true for computer groups than instance groups, because instance groups are generally very specialized and lower in the class path.
2. Groups are very useful for creating views related to objects of the same type. For example, let’s say we have two classes that are hosted by a server role class named Incoming Queue and Outgoing Queue. These are essentially the same type of object, but might be discovered under different classes. Creating an instance group containing Incoming Queue and Outgoing Queue objects might make sense here, and would allow us to create a consolidated view of all Queue objects in a state view.
How to create the instance group
In this example, I have two classes which discover objects of the same type; Application X Upload Directory and Application X Download Directory. Both classes are hosted by File Server Role. I want to group these directory instances.
First I’ll create the Singleton class for the new Application X Directories instance group.
If you cannot find Instance Group for a base class, you’ll need to add the Microsoft.SystemCenter.InstanceGroup.Library as a reference in your management pack properties.
Next, create the discovery to populate your new instance group class.
On the General tab, target your instance group.
On the Discovered Classes tab, add the classes that will be discovered and contained in the new group. In this example, this will be the Application X Download Directory and Application X Upload Directory classes.
On the Configuration tab, click Browse for a type…
Find Group Populator and give your new module a name.
On the Configuration screen, click Edit…
Highlight all except for the first line.
Delete all highlighted content, and replace it with the following.
<RuleId>$MPElement$</RuleId> <GroupInstanceId>$MPElement[Name="your_application.your_group"]$</GroupInstanceId> <MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="your_application.your_first_class"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> </MembershipRule> <MembershipRule> <MonitoringClass>$MPElement[Name="your_application.your_second_class"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> </MembershipRule> </MembershipRules> </Configuration>
Now replace red lines in the above XML with your management pack specific information.
The computer group: YOUR_APPLICATION.YOUR_GROUP
The instances that we discovered in our first class: YOUR_APPLICATION.YOUR_FIRST_CLASS
Close the editor, saving your changes, and you should see something like this.
Click OK and you’re done.
ApplicationX.Discovery.DownloadDirectory is my first class, and ApplicationX.Discovery.UploadDirectory is my second class in this example. Now, if you have more than two class instances to add, you can do this. Just keep in mind that in most cases we do want to see the same types of objects. In other words, it wouldn’t make much sense to add CPU instances to my group.
As you can see here, I created a consolidated view showing state of these same types of objects contained in my new group.
Very nice. Now customer doesn’t need to navigate two separate views to see state of both types of directories.
Today I got a question from a customer about the different Icons being uses in the Authoring Pane in
1. what if i want to nest groups?
2. what if i just want to create an empty group with no discovery that i'm going to manually populate with explicit members once it gets into the ops console?
John - taken from Brian Wren's page: blogs.technet.com/.../programmatically-creating-groups.aspx