Share via


Microsoft.Windows.TimedScript.PerformanceProvider

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

The Microsoft.Windows.TimedScript.PerformanceProvider data source module type is used to run a script as part of a scheduled workflow and returns System.PerformanceData data results.

Usage

This module is commonly used to run a scheduled script on a monitored computer and returns data in the System.PerformanceData format.

Type Definition

      <DataSourceModuleType ID="Microsoft.Windows.TimedScript.PerformanceProvider" Accessibility="Public" Batching="false">
        <Configuration>
          <IncludeSchemaTypes>
            <SchemaType>System!System.ParamListSchema</SchemaType>
            <SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
            <SchemaType>System!System.CommandExecuterSchema</SchemaType>
          </IncludeSchemaTypes>
          <xsd:element name="IntervalSeconds" type="xsd:int" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="SyncTime" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="ScriptName" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="Arguments" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="ScriptBody" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="SecureInput" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:simpleType>
              <xsd:restriction base="xsd:string">
                <xsd:maxLength value="256" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element name="TimeoutSeconds" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element minOccurs="0" maxOccurs="1" name="EventPolicy" type="CommandExecuterEventPolicyType" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="ObjectName" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="CounterName" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="InstanceName" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="Value" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
        </Configuration>
        <OverrideableParameters>
          <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
          <OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
          <OverrideableParameter ID="Arguments" Selector="$Config/Arguments$" ParameterType="string" />
          <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
        </OverrideableParameters>
        <ModuleImplementation Isolation="Any">
          <Composite>
            <MemberModules>
              <DataSource ID="DS1" TypeID="Microsoft.Windows.TimedScript.PropertyBagProvider">
                <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
                <SyncTime>$Config/SyncTime$</SyncTime>
                <ScriptName>$Config/ScriptName$</ScriptName>
                <Arguments>$Config/Arguments$</Arguments>
                <ScriptBody>$Config/ScriptBody$</ScriptBody>
                <SecureInput>$Config/SecureInput$</SecureInput>
                <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
                <EventPolicy>$Config/EventPolicy$</EventPolicy>
              </DataSource>
              <ConditionDetection ID="Mapper1" TypeID="Performance!System.Performance.DataGenericMapper">
                <ObjectName>$Config/ObjectName$</ObjectName>
                <CounterName>$Config/CounterName$</CounterName>
                <InstanceName>$Config/InstanceName$</InstanceName>
                <Value>$Config/Value$</Value>
              </ConditionDetection>
            </MemberModules>
            <Composition>
              <Node ID="Mapper1">
                <Node ID="DS1" />
              </Node>
            </Composition>
          </Composite>
        </ModuleImplementation>
        <OutputType>Performance!System.Performance.Data</OutputType>
      </DataSourceModuleType>

Parameters

The Microsoft.Windows.TimedScript.PerformanceProvider module supports the following configuration parameters.

Parameter Type Overrideable Description

IntervalSeconds

Integer

True

Required parameter. The recurring time interval in seconds in which to run the script.

SyncTime

String

True

Required parameter. The synchronization time specified by using a 24-hour format. If you do not want to specify a synchronization time, you can include the element, but without any value (for example, <SyncTime/>).

ScriptName

String

False

Required parameter. Contains the file name of the script, including the extension that identifies the script type.

Arguments

String

True

Required parameter. Contains the arguments to be supplied to the script while it runs.

ScriptBody

String

False

Required parameter. Contains the script contents. If the script contains XML characters that must be escaped, we recommend that you wrap the entire script in a CDATA element.

SecureInput

String

False

Optional parameter. Contains the data to be passed to the script in a secure method. This is used to provide passwords to the script to be used while it runs. The string can have a maximum of 256 characters.

TimeoutSeconds

Integer

True

Required parameter. Specifies the time in which the script can run before being closed by the module and marked as failed.

EventPolicy

CommandExecuterEventPolicyType

False

Optional parameter. Defines the expected output and the behavior based on unexpected output from the script.

ObjectName

String

False

Required parameter. Specifies the performance object name.

CounterName

String

False

Required parameter. Specifies the name of the performance counter.

InstanceName

String

False

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

Value

String

False

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

For more information about the ScriptName, Arguments, ScriptBody, SecureInput, and TimeoutSeconds parameters of this module, see Microsoft.Windows.ScriptProbeAction.

Composition

The Microsoft.Windows.TimedScript.PerformanceProvider module is a composite module that contains the member modules that are described in the following table.

Workflow Run Order Module Type Usage

1

Microsoft.Windows.TimedScript.PropertyBagProvider

Runs a script as part of a scheduled workflow, and returns System.PropertyBagData data.

2

System.Performance.DataGenericMapper

Maps data of any type to the System.Performance.Data type.

Module Type Usage

Microsoft.Windows.TimedScript.EventProvider

Runs a script as part of a scheduled workflow, and returns System.Event.Data data.

External Module References

None.

Sample

The following example shows a rule that runs a script in 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. For this scenario, you could use the Microsoft.Windows.TimedScript.PropertyBagProvider module type along with the System.Performance.DataGenericMapper module type to achieve the same result, but the Microsoft.Windows.TimedScript.PerformanceProvider combines both steps in one module.

     <Rule ID="MPAuthoring.Scripts.TimedPerformanceData" Enabled="true" Target="Windows!Microsoft.Windows.LocalApplication" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
        <Category>Custom</Category>
        <DataSources>
          <DataSource ID="PerformanceDataSource" TypeID="Windows!Microsoft.Windows.TimedScript.PerformanceProvider">
            <IntervalSeconds>60</IntervalSeconds>
            <SyncTime />
            <ScriptName> PerfProvider.vbs</ScriptName>
            <Arguments />
            <ScriptBody><![CDATA[
Option Explicit
Dim oAPI, oBag

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

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

Call oAPI.Return(oBag)
]]></ScriptBody>
            <TimeoutSeconds>30</TimeoutSeconds>
            <ObjectName>ApplicationX</ObjectName>
            <CounterName>$Data/Property[@Name='CounterName']$</CounterName>
            <InstanceName />
            <Value>$Data/Property[@Name='Value']$</Value>
          </DataSource>
        </DataSources>
        <WriteActions>
          <WriteAction ID="WriteToDB" TypeID="SC!Microsoft.SystemCenter.CollectPerformanceData" />
        </WriteActions>
      </Rule>

Information

   

Module Type

WriteActionModuleType

Input Type

None

Output Type

System.Performance.Data

Implementation

Composite

Library

Microsoft.Windows.Library