Share via


Template

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

Represents a template definition.

Schema Hierarchy

ManagementPack
  Templates
    Template

Syntax

<Template ID=”TemplateID” Comment=”Comment” Purpose=”Purpose”>
   <Configuration>…</Configuration>
   <References>…</References>
   <Implementation>…</Implementation>
</Template>

Attributes and Elements

The following sections describe attributes, child elements, and the parent element of the Template element.

Attributes

Attribute Description

ID

Required attribute. Represents the identity of the element. To learn how to identify your element in a management pack, see Element Identity and Namespace Conventions.

Comment

Optional attribute. Represents commentary by the management pack author.

Purpose

Optional attribute. Specifies the type of template and in which wizard it will be available.

Purpose Attribute Values

Value Description

Empty or unspecified.

This template will appear in the Management Pack Templates wizard.

RuleCreation

This is a template for a rule definition and will appear in the rule wizard.

TaskCreation

This is a template for a task definition and will appear in the task wizard.

Child Elements

Element Description

Configuration (Template)

Required element. Represents the parameters for a template definition.

References (Template)

Required element. Contains references to external management packs.

Implementation (Template)

Required element. The management pack fragment that will be inserted into the target management pack.

Parent Elements

Element Description

Templates

Contains each template defined in a management pack.

Remarks

If you define a template in your management pack, it will appear in the Operations console. When the user provides the correct configuration data and runs the template, the output will be either a new management pack or part of a management pack. A template can be used to create classes, rules, monitors, tasks, and so on. It can be as simple or as complex as required. The goal of templates is to fulfill common monitoring scenarios such as monitoring a Windows service, monitoring a TCP port, or monitoring an OLEDB connection. The user does not have to create the individual management pack objects that are required to achieve the monitoring. Instead, the user provides the configuration through a simple wizard. Operations Manager runs the template to output the management pack fragment.

Warning

The creation of custom management pack templates is not supported in the current release of Operations Manager.

Example

The following sample XML sample illustrates a template that has been designed for creating a script task.

<Template ID="Microsoft.SystemCenter.TaskTemplates.ScriptTask" Purpose="TaskCreation">
  <Configuration>
    <xsd:element name="ID" type="xsd:string" />
    <xsd:element name="Name" type="xsd:string" />
    <xsd:element name="Description" type="xsd:string" />
    <xsd:element name="Target" type="xsd:string" />
    <xsd:element name="Category" type="xsd:string" />
    <xsd:element name="LocaleId" type="xsd:string" />
    <xsd:element name="ScriptName" type="xsd:string" />
    <xsd:element name="Arguments" type="xsd:string" />
    <xsd:element name="ScriptBody" type="xsd:string" />
    <xsd:element name="TimeoutSeconds" type="xsd:integer" />
  </Configuration>
  <References>
    <Reference ID="Windows" />
  </References>
  <Implementation>
    <Monitoring>
      <Tasks>
        <Task ID="$TemplateConfig/ID$" Target="$TemplateConfig/Target$" Accessibility="Public">
          <Category>$TemplateConfig/Category$</Category>
          <WriteAction ID="PA" TypeID="$Reference/Windows$Microsoft.Windows.ScriptWriteAction">
            <ScriptName>$TemplateConfig/ScriptName$</ScriptName>
            <Arguments>$TemplateConfig/Arguments$</Arguments>
            <ScriptBody>$TemplateConfig/ScriptBody$</ScriptBody>
            <TimeoutSeconds>$TemplateConfig/TimeoutSeconds$</TimeoutSeconds>
          </WriteAction>
        </Task>
      </Tasks>
    </Monitoring>
    <LanguagePacks>
      <LanguagePack ID="$TemplateConfig/LocaleId$" IsDefault="true">
        <DisplayStrings>
          <DisplayString ElementID="$TemplateConfig/ID$">
            <Name>$TemplateConfig/Name$</Name>
            <Description>$TemplateConfig/Description$</Description>
          </DisplayString>
        </DisplayStrings>
      </LanguagePack>
    </LanguagePacks>
  </Implementation>
</Template>

See Also

Reference

Templates