Share via


Management Pack Service Model Exercise #2 - Creating a Group


Overview

 

The following procedures explain how to create groups using both 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 #2.  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

Sample Code

A sample of the completed code for each exercise is available in the TechNet Gallery.  There is a separate sample for each exercise that includes the management pack completed at the end of that exercise and each preceding exercise.  This strategy allows you to work through each exercise in order and then compare your results.  For VSAE, this also includes the Visual Studio solution. 

Details

Classes are created in the following procedures for an instance group, a computer group, and a health rollup.  They are not populated with any instances yet though. To populate the groups, complete the exercise Populating a Group.


Authoring Console Procedure

Adding a reference for Instance Group Library

  1. Select File, and then select Management Pack Properties.
  2. Click the References tab.
  3. Click Add Reference.
  4. Navigate to the folder where the Authoring console is installed, and select Microsoft.SystemCenter.InstanceGroup.Library.mp.
  5. Click in the Alias box, and change the alias to SCIG. Click OK. Any alias can be used for the alias. A short string is typically most convenient.

Creating an instance group

  1. In the Authoring console, select Service Model, and then select Classes.
  2. Right-click in the Classes pane, select New, and then select Custom Class.
  3. In the Choose a unique identifier… box, type the name MyMP.MyInstanceGroup, and then click OK.
  4. On the General tab, do the following:
    1. In the Base Class box, select Browse all classes.
    2. In the Management Pack Class Chooser box, select Microsoft.SystemCenter.InstanceGroup, and then click OK.
    3. In the Name box, type My Instance Group.
  5. In the Attributes pane, select Singleton. Click OK.
  6. Select File, and then click Save.

Creating a computer group

  1. In the Authoring console, select Service Model, and then select Classes.
  2. Right-click in the Classes pane, select New, and then select Computer Group.
  3. In the ID box, type the name MyMP.MyComputerGroup.
  4. In the Display Name box, type My Computer Group.
  5. Click Finish.
  6. Select File, and then click Save.

Creating a group for health rollup

  1. In the Authoring console, select Service Model, and then select Classes.
  2. Right-click in the Classes pane, select New, and then select Custom Class.
  3. In the Choose a unique identifier box, type the name MyMP.HealthRollup, and then click OK.
  4. On the General page, do the following:
    1. In the Base Class box, select Browse all classes.
    2. In the Management Pack Class Chooser box, select System.ComputerRole.
    3. In the Name box, type My Health Rollup. Click OK.
  5. In the Attributes pane, select Singleton. Click OK.
  6. Select File, and then click Save.

Visual Studio Authoring Extensions Procedure

Adding a reference for Instance Group Library

  1. In Visual Studio, open the MyMP solution.
  2. In the Solution Explorer, right click References and click Add Reference.
  3. Select the Browse tab.
  4. Navigate to the folder where VSAE is installed and then the References\OM2007R2 folder.
  5. Select Microsoft.SystemCenter.InstanceGroup.Library.mp and click OK.
  6. Select Microsoft.SystemCenter.InstanceGroup.Library.mp.
  7. In the Properties box, change the Alias to SCIG.

Creating an instance group

  1. Right click the name of the solution and select Add and then New Item

  2. Select Group.

  3. In the Name box, type Groups.mpx and click Add.

  4. Remove the comments from the Groups.mpx file.

  5. Replace the ClassType entry with the following XML. This creates the Instance Group class. Note that you can use Intellisense to manually type in each entry.  Type the < character to be prompted with valid tags. Press Ctrl+SpaceBar on the Base entry to prompt for available base classes.

    <ClassType
      ID="MyMP.MyInstanceGroup"
      Base="SCIG!Microsoft.SystemCenter.InstanceGroup"
      Accessibility="Internal"
      Abstract="false"
      Hosted="false"
      Singleton="true">
    </ClassType>
    
  6. Replace the DisplayString entry with the following XML. This creates the display string for the Computer Role base abstract class. Note that you can use Intellisense to manually type in each entry.  Type the < character to be prompted with valid tags.

    <DisplayString ElementID="MyMP.MyInstanceGroup">
      <Name>My Instance Group</Name>
      <Description></Description>
    </DisplayString>
    
  7. Select File, and then click Save Groups.mpx.

  8. Select Build and then Build Solution.

  9. Ensure that you don't receive any errors.

Creating a computer group

  1. In Groups.mpx, add the following XML after the ClassType definition for MyMP.MyInstanceGroup. This creates the Computer Group class. Note that you can use Intellisense to manually type in each entry.  Type the < character to be prompted with valid tags. Press Ctrl+SpaceBar on the Base entry to prompt for available base classes.

    <ClassType
      ID="MyMP.MyComputerGroup"
      Base="SC!Microsoft.SystemCenter.ComputerGroup"
      Accessibility="Internal"
      Abstract="false"
      Hosted="false"
      Singleton="true">
    </ClassType>
    
  2. Replace the DisplayString entry with the following XML. This creates the display string for the Computer Role base abstract class. Note that you can use Intellisense to manually type in each entry.  Type the < character to be prompted with valid tags.

    <DisplayString ElementID="MyMP.MyComputerGroup">
      <Name>My Computer Group</Name>
      <Description></Description>
    </DisplayString>
    
  3. Select File, and then click Save Groups.mpx.

  4. Select Build and then Build Solution.

  5. Ensure that you don't receive any errors.

Creating a group for health rollup

  1. In Groups.mpx, add the following XML after the ClassType definition for MyMP.MyInstanceGroup. This creates the Computer Group class. Note that you can use Intellisense to manually type in each entry.  Type the < character to be prompted with valid tags. Press Ctrl+SpaceBar on the Base entry to prompt for available base classes.

    <ClassType
      ID="MyMP.MyHealthRollup"
      Base="System!System.ComputerRole"
      Accessibility="Internal"
      Abstract="false"
      Hosted="false"
      Singleton="true">
    </ClassType>
    
  2. Replace the DisplayString entry with the following XML. This creates the display string for the Computer Role base abstract class.

    <DisplayString ElementID="MyMP.MyHealthRollup">
      <Name>My Health Rollup</Name>
      <Description></Description>
    </DisplayString>
    
  3. Select File, and then click Save Groups.mpx.

  4. Select Build and then Build Solution.

  5. Ensure that you don't receive any errors.

See Also