$MPElement

Applies To: Operations Manager 2007 R2, System Center Operations Manager 2007

You can use the $MPElement variable when you need to retrieve the GUID of any Management Pack element or sub-element of a Management Pack element. Some elements, such as the Discovery element, have to distinguish between several objects that are instances of a class, and each instance of a discovered class is assigned a GUID.

$MPElement[Name=” ElementName ”]/SubElementName$

Remarks

The following table describes each of the sections in the $MPElement syntax.

Syntax Section Description

$MPElement

The name of the variable that you must use. Type as is.

Name=Element Name

The value of the ID attribute of a management pack element. The Management Pack element created in this element can be defined in your management pack or in another management pack or library. If this element is defined in another management pack or library, you must prepend the alias of the management pack or library that it is defined in by using the Alias! notation.

SubElementName

Retrieves the GUID of an object that is defined in a child element of the Management Pack element defined in the class name section of this variable. SubElementName is required only if the GUID you must retrieve is in a child element that is no more than one level down from the parent element.

The following example defines an object discovery that defines membership in the AppXComponent group. This means that for every AppXComponent group that exists on a computer, a corresponding discovery object is created on that local computer’s agent. Each discovery, on every computer that has the AppXComponent group, has its own unique GUID, which is why the RuleID, MonitoringClass, and RelationshipClass elements use the $MPElement variable for their values, as follows:

  • The value of the RuleID element is the GUID of the specific discovery rule that exists on an agent.

  • The value of the MonitoringClass element is the GUID of the current AppXComponent group.

  • The value of the RelationshipClass element is the GUID of the relationship defined between the current AppXComponent group and the AppXComponents group.

    <Discovery ID="Microsoft.Demo.Discovery.Group.AppXComponents.Discovery" Target="Microsoft.Demo.Discovery.Group.AppXComponents" Enabled="true">
      <Category>Discovery</Category>
      <DiscoveryTypes/>
      <DataSource ID="DS" TypeID="SC!Microsoft.SystemCenter.GroupPopulator">
        <RuleId>$MPElement$</RuleId>
        <GroupInstanceId>$Target/Id$</GroupInstanceId>
         <MembershipRules>
           <MembershipRule>
            <MonitoringClass>$MPElement[Name="Microsoft.Demo.Discovery.AppXComponent"]$</MonitoringClass>
            <RelationshipClass>$MPElement[Name="Microsoft.Demo.Discovery.AppXComponentsGroupContainsAppXComponents"]$</RelationshipClass>
          </MembershipRule>
        </MembershipRules>
      </DataSource>
    </Discovery>