System.Performance.DataGenericMapper

Applies To: System Center 2012 - Operations Manager, System Center 2012 R2 Operations Manager, System Center 2012 SP1 - Operations Manager

System.Performance.DataGenericMapper is a condition detection module type that is used to map data of any type to performance data that can be stored in the Operations Manager database and the data warehouse.

Usage

Use this module to map data in a workflow to a data type that is of the System.Performance.Data data type.

Type Definition

<ConditionDetectionModuleType ID="System.Performance.DataGenericMapper" Accessibility="Public" Stateful="false" PassThrough="false" Batching="false">
  <Configuration>
    <xsd:element name="ObjectName" type="xsd:string" />
    <xsd:element name="CounterName" type="xsd:string" />
    <xsd:element name="InstanceName" type="xsd:string" />
    <xsd:element name="Value" type="xsd:string" />
  </Configuration>
  <ModuleImplementation>
    <Native>
      <ClassID>CBBE09D5-8DF8-4843-87A9-DD5AED662D29</ClassID>
    </Native>
  </ModuleImplementation>
  <OutputType>System.Performance.Data</OutputType>
  <InputTypes>
    <InputType>System!System.BaseData</InputType>
  </InputTypes>
</ConditionDetectionModuleType>

Parameters

The System.Event.GenericDataMapper module supports the configuration parameters described in the following table.

Parameter Type Overrideable Description

ObjectName

String

False

Required parameter. Contains the performance object name.

CounterName

String

False

Required parameter. Contains the performance counter name.

InstanceName

String

False

Required parameter. Contains the instance name but can empty if there is only a single instance.

Value

String

False

Required parameter. Contains the numeric value for the performance value.

Composition

The System.Performance.DataGenericMapper module is a native module.

None.

External Module References

The System.Performance.DataGenericMapper module is a member of the public module described in the following table.

Module Type Library Usage

Microsoft.Windows.WmiPerfCounterProvider

Microsoft.Windows.Library

Queries Windows Management Instrumentation (WMI) for performance counter data at the specified frequency and returns the information as a System.Performance.BaseData type.

Sample

The following XML example shows a rule that executes a script on a timed interval. The data in the property bag output from the script is used to generate a single performance point and store it in the Operations Manager database. The script generates a random value between 0 and 100. Generally, for this scenario, you should use the Microsoft.Windows.TimedScript.PerformanceProvider module type that is defined in Microsoft.Windows.Library because this provides the composition of the script and the mapper in a data source. This following example is for illustration purposes only.

<Rule ID="Microsoft.Samples.PerfMapperSingle" Target="Microsoft.Samples.ApplicationX" Enabled="false">
  <Category>Custom</Category>
  <DataSources>
    <DataSource ID="Script" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">
      <IntervalSeconds>60</IntervalSeconds>
      <SyncTime/>
      <ScriptName>Microsoft.Samples.PerfMapper.vbs</ScriptName>
      <Arguments/>
      <ScriptBody>
        <![CDATA[
Option Explicit
Dim OMApi, OMPBag

Set OMApi = CreateObject("MOM.ScriptAPI")
Set OMPBag = OMApi.CreatePropertyBag()

Call OMPBag.AddValue("CounterName", "Test Counter 1")
Randomize()
Call OMPBag.AddValue("Value", CInt(Rnd()*100))

Call OMAPI.Return(OMPBag)
]]>
      </ScriptBody>
      <TimeoutSeconds>30</TimeoutSeconds>
    </DataSource>
  </DataSources>
  <ConditionDetection ID="Mapper" TypeID="Perf!System.Performance.DataGenericMapper">
    <ObjectName>AppplicationX</ObjectName>
    <CounterName>$Data/Property[@Name='CounterName']$</CounterName>
    <InstanceName/>
    <Value>$Data/Property[@Name='Value']$</Value>
  </ConditionDetection>
  <WriteActions>
    <WriteAction ID="WriteToDB" TypeID="SC!Microsoft.SystemCenter.CollectPerformanceData"/>
  </WriteActions>
</Rule>

The rule uses data from the script to set the counter name and the value of the performance counter. The following code example is an example data item from the script that is used by the mapper:

<DataItem type="System.PropertyBagData" time="2008-10-17T09:50:34.8054044-07:00" sourceHealthServiceId="B0BE86FA-56AD-1F2E-EE87-8DF72FC53818">
  <Property Name="CounterName" VariantType="8">Test Counter 1</Property>
  <Property Name="Value" VariantType="2">29</Property>
</DataItem

The following code example shows that this data item is mapped to the following performance data item and stored in the database:

<DataItem type="System.Performance.Data" time="2008-10-17T09:55:50.0519259-07:00" sourceHealthServiceId="B0BE86FA-56AD-1F2E-EE87-8DF72FC53818">
  <TimeSampled>2008-10-17T09:55:50.0429250-07:00</TimeSampled>
  <ObjectName>AppplicationX</ObjectName>
  <CounterName>Test Counter 1</CounterName>
  <InstanceName></InstanceName>
  <IsNull Type="Boolean">false</IsNull>
  <Value>13</Value>
</DataItem>

A data source that outputs multiple data items can be used with this module type to create multiple performance values during a single execution. The following code example shows a rule that executes a script on a timed interval. The script outputs four property bags; each property bag is mapped to an instance of a performance counter.

<Rule ID="Microsoft.Samples.PerfMapperMulti" Target="Microsoft.Samples.ApplicationX" Enabled="false">
  <Category>Custom</Category>
  <DataSources>
    <DataSource ID="Script" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">
      <IntervalSeconds>60</IntervalSeconds>
      <SyncTime/>
      <ScriptName>Microsoft.Samples.PerfMapper.vbs</ScriptName>
      <Arguments/>
      <ScriptBody>
        <![CDATA[
Option Explicit
Dim OMApi, OMPBag

Set OMApi = CreateObject("MOM.ScriptAPI")
Randomize()

Dim i
For i = 1 to 4
Set OMPBag = OMApi.CreatePropertyBag()
Call OMPBag.AddValue("CounterName", "Test Counter 2")
Call OMPBag.AddValue("InstanceName", "Instance" & i)
Call OMPBag.AddValue("Value", CInt(Rnd()*100))
Call OMApi.AddItem(OMPBag)
Next

Call OMAPI.ReturnItems()
]]>
      </ScriptBody>
      <TimeoutSeconds>30</TimeoutSeconds>
    </DataSource>
  </DataSources>
  <ConditionDetection ID="Mapper" TypeID="Perf!System.Performance.DataGenericMapper">
    <ObjectName>AppplicationX</ObjectName>
    <CounterName>$Data/Property[@Name='CounterName']$</CounterName>
    <InstanceName>$Data/Property[@Name='InstanceName']$</InstanceName>
    <Value>$Data/Property[@Name='Value']$</Value>
  </ConditionDetection>
  <WriteActions>
    <WriteAction ID="WriteToDB" TypeID="SC!Microsoft.SystemCenter.CollectPerformanceData"/>
  </WriteActions>
</Rule>

Information

   

Module Type

ConditionDetectionModuleType

Input Type

System.BaseData

Output Type

System.Performance.Data

Implementation

Native

Library

System.Library