Using Management Pack Context Parameters in Scripts
Applies To: Operations Manager 2007 R2, Operations Manager 2007 SP1, System Center Operations Manager 2007
Context parameters are variables that you can use in a Management Pack's XML file or in a custom runtime script that is added to a Management Pack. Context parameters allow you to reference runtime data for specific objects in the Management Pack. For example, you can reference the globally unique identifier of a class instance that is targeted by a rule.
Whether a context parameter is used in a Management Pack or in a runtime script, it must be nested between opening and closing dollar symbols ($) as shown in the following example:
$MPElement$
The following table describes the available context parameters that you can use in a Management Pack or in a runtime script.
Context Parameter | Description |
---|---|
$MPElement$ |
Provides the globally unique identifier (GUID) of the monitoring object (that is, discovery, monitor, rule, or task) in which the context parameter is used. |
$MPElement[Name='ElementName']$ |
References an element in the current Management Pack by name, as in the following example:
|
$MPElement[Name = 'MPAlias!ElementName']$ |
References an element in a referenced Management Pack by name, as in the following example:
|
$Target/Id$ |
Provides the GUID of the class instance that is targeted by the current monitoring object. |
$Target/ManagementGroup/Id$ |
Provides the GUID of the Management Group to which the class instance that is targeted by the current monitoring object belongs. |
$Target/ManagementGroup/Name$ |
Provides the name of the Management Group to which the class instance that is targeted by the current monitoring object belongs. |
$Target/Property[Type='ClassName']/PropertyName$ |
References a property of the class instance that is targeted by the current monitoring object. Use this syntax when the property is defined in the current Management Pack, as in the following example:
|
$Target/Property[Type='MPAlias!ClassName']/PropertyName$ |
References a property from a parent class of the target class instance. Use this syntax when the property is defined in a referenced Management Pack, as in the following example:
|
$Target/Host/Property[Type='ClassName']/PropertyName$ $Target/Host/Host/…/Property[Type='ClassName']/PropertyName$ |
References a property of any host of the class instance that is targeted by the current monitoring object. Use this syntax when the property is defined in the current Management Pack. Replace the ellipsis (…) with the appropriate number of Host keywords to navigate to any instance in the hosting hierarchy, as in the following example:
|
$Target/Host/Property[Type='MPAlias!ClassName']/PropertyName$ $Target/Host/Host/…/Property[Type='MPAlias!ClassName']/PropertyName$ |
References a property of any host of the class instance that is targeted by the current monitoring object. Use this syntax when the property is defined in a referenced Management Pack. Replace the ellipsis (…) with the appropriate number of Host keywords to navigate to any instance in the hosting hierarchy, as in the following example:
|
$Config/XPathExpression$ |
References a parameter that is defined in the configuration of a monitor or module type. This is used only for defining composites. The XPath expression must be defined relative to the <Configuration> element. For example, if a Configuration element is defined as follows:
a parameter can reference the element's value as follows:
|
$Data/XPathExpression$ |
References a data item (for example, a name-value pair that is stored in a MOMPropertyBag object). The XPath expression to reference a data item depends on the item's type. The following examples show data item references that include XPath expressions:
|
See Also
Tasks
How to Create Discovery Data by Using a Script
How to Create Monitoring Data by Using a Script
Concepts
Getting Started Developing Runtime Scripts
Runtime Scripts Overview