다음을 통해 공유


Operations Manager Management Pack Authoring - Dashboard Bindings and Variables

This document is part of the Operations Manager Management Pack Authoring Guide.  The Microsoft System Center team has validated this procedure as of Revision #3.  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.

Bindings

Bindings are used to pass data in and out of properties of a referenced component. The binding includes the identifier of the property and a value for the property using one of the Binding Value Types listed in the table below. The type of value provided to the property must either match the property’s type in the Component Type or inherit from that type.

Binding Value Type

Description

SimpleValue

Value for a simple data type such as a string or integer.

ComplexValue

Value for a complex data type.

ComplexValueCollection

Collection of multiple complex values.

Component

Another component type.

Reference

Value from a variable.

Target

The Target entity provided to the component.

Details on each of the Binding types is provided in the following sections.

SimpleValue

Resolves to a simple value. The syntax of a SimpleValue is shown below.

<ComponentImplementation TypeID="ElementID" TypeId="ComponentType">
  <Composite>
    <Component TypeID="ReferencedElementID">
      <Binding PropertyId="PropertyId">
        <SimpleValue Type="{SimpleType}" Value="{SimpleValue}" />
      </Binding>
    </Component> 
  </Composite>
</ComponentImplementation>

The attributes for a SimpleValue binding are listed in the following table:

Attribute

Description

Type

The type of simple object from the following list:
xsd://int Int32
xsd://string String
xsd://guid Guid
xsd://Boolean Boolean

Value

The string representation of the value. If not a string, this will be converted to the appropriate type at runtime. This can be an explicit value or a variable that resolves to a simple value.

ComplexValue

Resolves to a complex object that has multiple properties of its own. Standard Binding elements are used to define the values of each property.

<ComponentImplementation TypeID="ElementID" TypeId="ComponentType">
  <Composite>
    <Component TypeID="ReferencedElementID">
      <Binding PropertyId="PropertyId">
        <ComplexValue Type="DataType">
          <Binding PropertyId="PropertyName">
            <!-- Binding for the property -->
          </Binding>
          <Binding PropertyId="PropertyName">
            <!-- Binding for the property -->
          </Binding>
          <Binding PropertyId="PropertyName">
            <!-- Binding for the property -->
          </Binding>
        </ComplexValue>
      </Binding>
    </Component> 
  </Composite>
</ComponentImplementation>

The attributes for a ComplexValue binding are listed in the following table:

Attribute

Description

Type

Data type of the complex object.

ComplexValueCollection

Resolves to a collection of ComplexValues. The type of the collection must be explicitly declared. The only supported sub elements of a ComplexValueCollection are ComplexValue elements with the same data type specified for the collection or a data type derived from that data type.

<ComponentImplementation TypeID="ElementID" TypeId="ComponentType">
  <Composite>
    <Component TypeID="ReferencedElementID">
      <Binding PropertyId="PropertyId">
        <ComplexValueCollection Type="{CollectionDataType}">
          <ComplexValue Type="DataType">
            <Binding PropertyId="PropertyName">
              <!-- Binding for the property -->
            </Binding>
            <Binding PropertyId="PropertyName">
              <!-- Binding for the property -->
            </Binding>
            <Binding PropertyId="PropertyName">
              <!-- Binding for the property -->
            </Binding>
          </ComplexValue>
          <ComplexValue Type="DataType">
            <Binding PropertyId="PropertyName">
              <!-- Binding for the property -->
            </Binding>
            <Binding PropertyId="PropertyName">
              <!-- Binding for the property -->
            </Binding>
            <Binding PropertyId="PropertyName">
              <!-- Binding for the property -->
            </Binding>
          </ComplexValue>
        </ComplexValueCollection>
      </Binding>
    </Component> 
  </Composite>
</ComponentImplementation>

The attributes for a ComplexValueCollection binding are listed in the following table:

Attribute

Description

Type

Data type of the complex collection.

Component Bindings

Resolves to a component. The instance of the referenced component is passed to a property on the declared parent component. The property on the parent component must be of type component://. The specified Component Type will then typically contain further bindings for any properties that it requires.

<ComponentImplementation TypeID="ElementID" TypeId="ComponentType">
  <Composite>
    <Component TypeID="ReferencedElementID">
      <Binding PropertyId="PropertyId">
        <Component TypeID="ReferencedElementID">
          <!-- Bindings for the component -->
        </Component>
      </Binding>
    </Component> 
  </Composite>
</ComponentImplementation>

Target

Refers to the Target of the Component Implementation. This can only be used if the Component Implementation has a Target. The instance data type must be the same as the referenced Component Type Target data type.

<ComponentImplementation TypeID="ElementID" TypeId="ComponentType" Target="TargetType">
  <Composite>
    <Component TypeID="ReferencedElementID">
      <Binding PropertyId="PropertyId">
        <Component TypeID="ReferencedElementID">
          <Target>
            <!-- Bindings for the target -->
          </Target>
        </Component>
      </Binding>
    </Component> 
  </Composite>
</ComponentImplementation>

Reference

Reference to a variable. The value of the variable is resolved and then provided in the binding.

<ComponentImplementation TypeID="ElementID" Target="TargetType">
  <Composite>
    <Component TypeID="ReferencedElementID">
      <Binding PropertyId="PropertyId">
        <Reference>{DataReferenceMarkup}</Reference>
      </Binding>
    </Component> 
  </Composite>
</ComponentImplementation>

Variables

Variables are used to resolve different values at runtime. These are similar to the variables that are used in workflows in management packs. Like those variables, dashboard variables are enclosed in $ and are resolved to a value before the component is processed.

$Target Variables

$Target variables resolve properties on the target of a Component Implementation.

Variable

Resolves To

$Target$

Target object.

$Target/Property$

Property of the target object.

$Target/Property/Property$

Nested property in a complex property of the target object. Syntax supports N levels of property resolution.

$MPReference Variables

$MPReference variables resolve to an element in a management pack or a property of an element.

Variable

Resolves To

$MPReference/ManagementPackId!MPElementID$

MPElement object with ID matching MPElementID in the management pack with the ID ManagementPackId.

$MPReference/ManagementPackId!MPElementID$ with Properties

Note that management pack aliases cannot be used with $MPReference variables, but you must instead specify the entire name of the management pack. Any values specified in an attribute of a component are processed on the management server, and aliases can be used. Bindings are processed on the workstation though where aliases cannot be resolved.

$Property Variables

$Property variables resolve to the value of a property of the Component Type that the Component Implementation is based on. This could be an input property where a value is provided by another component calling the current component. It could also be an output property where the current component sets the value that can be used by another component calling it.

Variable

Resolves To

$Property/PropertyName$

Binding property value declared in the referencing Component Implementation.

$Property/PropertyName/Property$

Binding property value declared in the referencing Component Implementation.

$Property/PropertyName/Property/Property$

Nested binding property value in a complex property declared in the referencing Component Implementation. Syntax supports N levels of property resolution.

$Variable Variables

$Variable variables resolve to the value of a component variable that is defined within the current Component Implementation.

Variable

Resolves To

$Variable/VariableId$

Value of a variable with VariableId defined in the scope of a Component Implementation.

$Variable /VariableId /Property$

Value of a property of a variable with VariableId defined in the scope of a Component Implementation.

$Variable/VariableId /Property/Property$

Nested variable property value in a complex property declared in the scope of a Component Implementation. Syntax supports N levels of property resolution.

$Service Variables

$Service variables are global variables that are available to all components of a dashboard.

Variable

Resolves To

$Service/ServiceId$

Value of a Service Variable with ServiceId.

$Service/ServiceId/Property$

Value of a property of a Service Variable with ServiceId.

$Service/ServiceId/Property/Property$

Nested Service Variable property value in a complex property. Syntax supports N levels of property resolution.

There is a specific set of Service Variables that are available to all dashboards.  These are described in the following table.

Service Variable Type Description
ConnectionSessionTicket xsd://string Used by data providers to connect to the correct management group.  This variable is not used in custom components since custom data sources are currently not supported.
DashboardState xsd://Microsoft.SystemCenter.Visualization.Library!DashboardStatus/DashboardState Indicates when the dashboard is closed so that the object can remove event descriptions.  This variable is only used for special cases so it is not used in custom components.
IsBusy xsd://Microsoft.SystemCenter.Visualization.Library!BusyType/Busy Indicates if the current component is busy.  This provides a method for parent components
LastError xsd://Microsoft.SystemCenter.Visualization.Library!ErrorType/Error The last error that occurred in the component.  A null value indicates that the error has been resolved.
RefreshAction xsd://Microsoft.SystemCenter.Visualization.Library!Microsoft.SystemCenter.Visualization.ActionTypes/AutoRefreshAction
or
xsd://Microsoft.SystemCenter.Visualization.Library!Microsoft.SystemCenter.Visualization.ActionTypes/ManualRefreshAction

Both use a common base class of
xsd://Microsoft.SystemCenter.Visualization.Library!Microsoft.SystemCenter.Visualization.ActionTypes/RefreshAction

Indicates how refresh of the dashboard is handled.  A value of AutoRefreshAction indicates that it is automatically refreshed every minute.  ManualRefreshAction requires the user to manually refresh the dashboard.
SelectedItems Any DataObjectCollection Item that is currently selected in any component.  This variable can indicate multiple items in a component that is configured to allow multiple selections.
Subtitle xsd://string When a string is written to this service, it appears in the title of the widget.  For example, the alert widget uses this variable to display the alert count in the title.  This variable is only used in widgets.

Service Overrides

You can change the value of a Service variable through a Service Override.  When a Component Implementation uses a Service, it will walk through its parent components looking for a Service Override.  If one is found then that value is used for the Service variable.  If not, then the original value of the Service is used.

The following sample XML shows the syntax for declaring a Service Override.

<ComponentImplementation TypeID="ElementID" TypeId="ComponentType"> 
  <Composite> 
    <ServiceOverride
        ServiceId="{ServiceId}"
        Type="{ServiceType}"
        OriginalKnownAsVariable="{OriginalKnownAsVariable}" /> 
    <Component TypeID="ReferencedElementID"> 
        <!-- Bindings for the component –> 
    </Component> 
  </Composite> 
</ComponentImplementation>

The following table provides the attributes of a Service Override.

 

Attribute Description
ID Identifier for the Service Override. Must be unique within the Component Implementation.
Type The type of the Variable. Corresponds to one of the Binding Types.
OriginalKnownAsVariable A name to refer to the initial value that will always be available regardless of how many Service Overrides are applied

Data Types

The value for each binding must have a particular Data Type. Data Types are also used for Targets on Component Types and Component Implementations. The Data Type must either match the type of the property it is providing a value for or one that inherits from that type. Properties will often be configured to use BaseDataType since all other types inherit from this one. This allows any binding to be used for that property.

The DataTypes can be illustrated with the following diagram showing that each inherits from BaseDataType.
       

xsd:// Type

The xsd:// type provides access to all simple and complex types in every Schema Type across all management packs installed in the management group. This could be a simple type such as an integer or a single property of a complex type. Or it could be a complex type with multiple properties of its own.

Syntax

xsd://{Data Type}
xsd://{ManagementPackId}!{SchemaTypeId}/{Type Name}
xsd://{ManagementPackId}!{SchemaTypeId}/{Type Name}/{Property}

Example

For example, the management pack Microsoft.SystemCenter.Visualization includes the definition for different types that are required by components and widgets. One of these schema types is Microsoft.SystemCenter.Visualization.ColumnType which includes the properties required for a column in a grid component.

Another Schema Type defined in Microsoft.SystemCenter.Visualization is Microsoft.SystemCenter.Visualization.OperationalDataTypes. This includes a complex type called AlertType that supports any component that displays alerts. The properties of this complex type include all of the properties of an Operations Manager alert.

The following sample XML shows how a ComplexType is used for the ColumnType since it requires multiple properties. This is included in a ComplexTypeCollection since multiple columns are required for the particular grid component being configured.

<ComplexValueCollection Type="xsd://Microsoft.SystemCenter.Visualization.Library!Microsoft.SystemCenter.Visualization.ColumnType/DataGridColumn[]">
  <ComplexValue Type="xsd://Microsoft.SystemCenter.Visualization.Library!Microsoft.SystemCenter.Visualization.ColumnType/DataGridColumn">
    <Binding PropertyId="PropertyName">
      <SimpleValue Type="xsd://string" Value="Severity" />
    </Binding>
    <!-- Bindings for the other properties of the column -->
  </ComplexValue>
  <!-- ComplexValues for other columns -->
</ComplexValueCollection>

 

mpinstance:// Type

The mpinstance:// type represents a managed entity in the management group. This type is often used in the Target attribute for Component Types and Component Implementations.

Syntax

mpinstance://{ManagementPackId}!{ClassId}

Example

The following example shows a ComponentType that represents a dashboard that displays data related to managed SQL Server Database Engines.

<ComponentType ID="SampleDashboard.AuxillaryDashboard" Target="mpinstance://Microsoft.SQLServer.Library!Microsoft.SQLServer.DBEngine[]" Accessibility="Internal"/>

component:// Type

The component:// type represents another component. This type is used when defining a property on a component that requires another component.

Syntax

component://{ManagementPackId}!{ComponentId}

Example

The following XML sample shows the GridLayout component that has a configuration based on another component called GridLayoutConfigBase. This component is referenced in the property named Config.

<ComponentType ID="Microsoft.SystemCenter.Visualization.GridLayout" Accessibility="Public">
  <Property Name="Config" Type="component://Microsoft.SystemCenter.Visualization.Library!Microsoft.SystemCenter.Visualization.GridLayoutConfigBase" BindingDirection="In" />
  <Property Name="ConfigType" Type="xsd://string" BindingDirection="In" />
  <Property Name="CellRegionMappings" Type="xsd://Microsoft.SystemCenter.Visualization.Library!Microsoft.SystemCenter.Visualization.LayoutConfig/CellRegionMapping[]" BindingDirection="In" />
  <Property Name="ComponentDefinitionIsReadOnly" Type="xsd://boolean" BindingDirection="In" />
</ComponentType>

See Also