Management Pack Service Model Exercise #8 - Populating a Group
Overview
The following procedures show how to create a discovery to populate groups using the Operations Manager 2007 Authoring console and Visual Studio Authoring Extensions. This exercise is part of the System Center Operations Manager Management Pack Authoring Center.
Product Versions
This exercise applies to the following products:
- System Center Operations Manager 2007 R2
- System Center 2012 Operations Manager
- System Center 2012 Operations Manager SP1
Prerequisites
Before you perform this procedure, you must first complete the following prerequisite procedures:
- Creating a New Management Pack - Create the management pack.
- Creating a Class - Create the classes that will be contained in the group.
- Creating a Group - Create the groups that will be populated.
- Creating a Containment Relationship - Create relationships that will be discovered.
Revisions
The Microsoft System Center team has validated this procedure as of revision #1. We will continue to review any changes and periodically provide validations on later revisions as they are made. Please feel free to make any corrections or additions to this procedure that you think would assist other users.
Authoring Console Procedure
Populate an Instance Group
- Select Health Model, and then select Discoveries.
- Right-click in the right side pane, select New, and then select Custom Discovery.
- In the Choose a unique identifier box, type MyMP.Discovery.PopulateMyInstanceGroup and click OK.
- On the General page, do the following:
- In the Name box, type Populate My Instance Group.
- In the Target box, select MyMP.MyInstanceGroup.
- On the Discovered Classes tab, do the following:
- Click Add above the Discovered relationships and their attributes pane and select Add discovered relationship.
- In the Management Pack Relationship Chooser box, select Microsoft.SystemCenter.InstanceGroupContainsEntities, and then click OK.
- On the Configuration tab, do the following:
- Select Browse for a type.
- In the Choose module type box, select Microsoft.SystemCenter.GroupPopulator.
- In the Module ID box, type GroupPopulator. Click OK.
- In the Value column of the RuleId row, type $MPElement$.
- In the Value column of the GroupInstanceId row, type $MPElement[Name="MyMP.MyInstanceGroup"]$.
- In the Value column of the >MonitoringClass row, type $MPElement[Name="MyMP.MyComputerRole1"]$.
- In the Value column of the >>RelationshipClass row, type $MPElement[Name="SCIG!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$. If an alias other than SCIG is used, this string should be replaced with the appropriate alias.
- Click OK.
- Select File, and then click Save.
Populate a Computer Group
- Select Health Model, and then select Discoveries.
- Right-click in the right-side pane, select New, and then select Custom Discovery.
- In the Choose a unique identifier box, type MyMP.Discovery.PopulateMyComputerGroup.
- On the General tab, do the following:
- In the Name box, type Populate My Computer Group.
- In the Target box, select MyMP.MyComputerGroup.
- On the Discovered Classes tab, do the following:
- Click Add above the Discovered relationships and their attributes pane, and select Add discovered relationship.
- Select Microsoft.SystemCenter.ComputerGroupContainsComputer. Click OK.
- On the Configuration page, do the following:
Select Browse for a type.
In the Choose module type box, select Microsoft.SystemCenter.GroupPopulator.
In the Module ID box, type GroupPopulator. Click OK.
Click Edit to start the external editor.
Copy and paste the following XML code between the Configuration tags.
< RuleId >$MPElement$</ RuleId > < GroupInstanceId >$MPElement[Name="MyMP.MyComputerGroup"]$</ GroupInstanceId > < MembershipRules > < MembershipRule > < MonitoringClass >$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</ MonitoringClass > < RelationshipClass >$MPElement[Name="SC!Microsoft.SystemCenter.ComputerGroupContainsComputer"]$</ RelationshipClass > < Expression > < Contains > < MonitoringClass >$MPElement[Name="MyMP.MyComputerRole1"]$</ MonitoringClass > </ Contains > </ Expression > </ MembershipRule > </ MembershipRules >
Close the external editor, and save the configuration in the Authoring console.
Click OK.
- Select File, and then click Save.
Visual Studio Authoring Extensions Procedure
Populate an Instance Group
Create the Discovery:
- In Solution Explorer, right click Right click Discoveries.mptg and click Open.
- Right click in the template window and select Add Template.
- Select Discovery (Custom) and click OK.
Configure the Discovery Properties:
- Right click the entry for NewDiscovery and select Properties Window.
- Change the ID to Discovery.PopulateMyInstanceGroup.
- Change the Display Name to Populate My Instance Group.
Select the Discovery Target:
- Select Target and click the ellipse (...) button on the right of the field.
- Select MyMP.MyInstanceGroup and click OK.
Select and Configure the Discovery Data Source"
Select Data Source Type ID and click the ellipse (...) button on the right of the field.
Select Microsoft.SystemCenter.GroupPopulator and click OK.
Select Data Source Configuration and click the ellipse (...) button on the right of the field.
Copy the following XML into the configuration window between the <Configuration> tags. Note that you can use Intellisense to manually type in each entry.
<!-- GUID of the discovery. We will use $MPElement$ variable which specifies the current discovery. --> < RuleId >$MPElement$</ RuleId > <!-- GUID of the group we are populating. --> < GroupInstanceId >$MPElement[Name="MyMP.MyInstanceGroup"]$</ GroupInstanceId > <!-- Rules to determine which instances to add to the group. In this case, we are adding all instances of MyComputerRole1. --> < MembershipRules > < MembershipRule > < MonitoringClass >$MPElement[Name="MyMP.MyComputerRole1"]$</ MonitoringClass > < RelationshipClass >$MPElement[Name="SCIG!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</ RelationshipClass > </ MembershipRule > </ MembershipRules >
Save and Compile the Project:
- Select File, and then click Save Discoveries.mptg.
- Select Build and then Build Solution.
- Ensure that you don't receive any errors.
Populate a Computer Group
Create the Discovery:
- In Solution Explorer, right click Right click Discoveries.mptg and click Open.
- Right click in the template window and select Add Template.
- Select Discovery (Custom) and click OK.
Configure the Discovery Properties:
- Right click the entry for NewDiscovery and select Properties Window.
- Change the ID to Discovery.PopulateMyComputerGroup.
- Change the Display Name to Populate My Computer Group.
Select the Discovery Target:
- Select Target and click the ellipse (...) button on the right of the field.
- Select MyMP.MyComputerGroup and click OK.
Select and Configure the Discovery Data Source"
Select Data Source Type and click the ellipse (...) button on the right of the field.
Select Microsoft.SystemCenter.GroupPopulator and click OK.
Select Data Source Configuration and click the ellipse (...) button on the right of the field.
Copy the following XML into the configuration window between the <Configuration> tags. Note that you can use Intellisense to manually type in each entry.
<!-- GUID of the discovery. We will use $MPElement$ variable which specifies the current discovery. --> < RuleId >$MPElement$</ RuleId > <!-- GUID of the group we are populating. --> < GroupInstanceId >$MPElement[Name="MyMP.MyComputerGroup"]$</ GroupInstanceId > <!-- Rules to determine which instances to add to the group. --> <!-- In this case, we are adding all instances of Windows Computer that have at least one instance of MyComputerRole1. --> < MembershipRules > < MembershipRule > < MonitoringClass >$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</ MonitoringClass > < RelationshipClass >$MPElement[Name="SC!Microsoft.SystemCenter.ComputerGroupContainsComputer"]$</ RelationshipClass > < Expression > < Contains > < MonitoringClass >$MPElement[Name="MyMP.MyComputerRole1"]$</ MonitoringClass > </ Contains > </ Expression > </ MembershipRule > </ MembershipRules >
Save and Compile the Project:
- Select File, and then click Save Discoveries.mptg.
- Select Build and then Build Solution.
- Ensure that you don't receive any errors.