다음을 통해 공유


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:

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

  1. Select Health Model, and then select Discoveries.
  2. Right-click in the right side pane, select New, and then select Custom Discovery.
  3. In the Choose a unique identifier box, type MyMP.Discovery.PopulateMyInstanceGroup and click OK.
  4. On the General page, do the following:
    1. In the Name box, type Populate My Instance Group.
    2. In the Target box, select MyMP.MyInstanceGroup.
  5. On the Discovered Classes tab, do the following:
    1. Click Add above the Discovered relationships and their attributes pane and select Add discovered relationship.
    2. In the Management Pack Relationship Chooser box, select Microsoft.SystemCenter.InstanceGroupContainsEntities, and then click OK.
  6. On the Configuration tab, do the following:
    1. Select Browse for a type.
    2. In the Choose module type box, select Microsoft.SystemCenter.GroupPopulator.
    3. In the Module ID box, type GroupPopulator. Click OK.
    4. In the Value column of the RuleId row, type $MPElement$.
    5. In the Value column of the GroupInstanceId row, type $MPElement[Name="MyMP.MyInstanceGroup"]$.
    6. In the Value column of the >MonitoringClass row, type $MPElement[Name="MyMP.MyComputerRole1"]$.
    7. 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.
  7. Click OK.
  8. Select File, and then click Save.

Populate a Computer Group

  1. Select Health Model, and then select Discoveries.
  2. Right-click in the right-side pane, select New, and then select Custom Discovery.
  3. In the Choose a unique identifier box, type MyMP.Discovery.PopulateMyComputerGroup.
  4. On the General tab, do the following:
    1. In the Name box, type Populate My Computer Group.
    2. In the Target box, select MyMP.MyComputerGroup.
  5. On the Discovered Classes tab, do the following:
    1. Click Add above the Discovered relationships and their attributes pane, and select Add discovered relationship.
    2. Select Microsoft.SystemCenter.ComputerGroupContainsComputer. Click OK.
  6. On the Configuration page, do the following:
    1. Select Browse for a type.

    2. In the Choose module type box, select Microsoft.SystemCenter.GroupPopulator.

    3. In the Module ID box, type GroupPopulator. Click OK.

    4. Click Edit to start the external editor.

    5. 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      >      
      
    6. Close the external editor, and save the configuration in the Authoring console.

    7. Click OK.

  7. Select File, and then click Save.

Visual Studio Authoring Extensions Procedure

Populate an Instance Group

  1. Create the Discovery:

    1. In Solution Explorer, right click Right click Discoveries.mptg and click Open.
    2. Right click in the  template window and select Add Template.
    3. Select Discovery (Custom) and click OK.
  2. Configure the Discovery Properties:

    1. Right click the entry for NewDiscovery and select Properties Window.
    2. Change the ID to Discovery.PopulateMyInstanceGroup.
    3. Change the Display Name to Populate My Instance Group.
  3. Select the Discovery Target:

    1. Select Target and click the ellipse (...) button on the right of the field. 
    2. Select MyMP.MyInstanceGroup and click OK.
  4. Select and Configure the Discovery Data Source"

    1. Select Data Source Type ID and click the ellipse (...) button on the right of the field. 

    2. Select Microsoft.SystemCenter.GroupPopulator and click OK.

    3. Select Data Source Configuration and click the ellipse (...) button on the right of the field.

    4. 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    >  
      
  5. Save and Compile the Project:

    1. Select File, and then click Save Discoveries.mptg.
    2. Select Build and then Build Solution.
    3. Ensure that you don't receive any errors.

Populate a Computer Group

  1. Create the Discovery:

    1. In Solution Explorer, right click Right click Discoveries.mptg and click Open.
    2. Right click in the  template window and select Add Template.
    3. Select Discovery (Custom) and click OK.
  2. Configure the Discovery Properties:

    1. Right click the entry for NewDiscovery and select Properties Window.
    2. Change the ID to Discovery.PopulateMyComputerGroup.
    3. Change the Display Name to Populate My Computer Group.
  3. Select the Discovery Target:

    1. Select Target and click the ellipse (...) button on the right of the field. 
    2. Select MyMP.MyComputerGroup and click OK.
  4. Select and Configure the Discovery Data Source"

    1. Select Data Source Type and click the ellipse (...) button on the right of the field. 

    2. Select Microsoft.SystemCenter.GroupPopulator and click OK.

    3. Select Data Source Configuration and click the ellipse (...) button on the right of the field.

    4. 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    >  
      
  5. Save and Compile the Project:

    1. Select File, and then click Save Discoveries.mptg.
    2. Select Build and then Build Solution.
    3. Ensure that you don't receive any errors.

See Also