다음을 통해 공유


ClassType

Applies To: Operations Manager 2007 R2, System Center Operations Manager 2007

Represents a class type definition in the management pack.

Schema Hierarchy

ManagementPack
  TypeDefinitions
    EntityTypes
      ClassTypes
        ClassType

Syntax

<ClassType ID=”Company.Product.ClassID” Comment=”Comment” Accessibility=”Internal/Public” Abstract=” True/False” Base=”BaseClassID” Hosted=” True/False” Singleton=”True/False”>   <Property>…</Property>
</ClassType>

Attributes and Elements

The following sections describe attributes, child elements, and the parent element for the ClassType 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.

Accessibility

Required attribute. Defines the visibility of the class type.

Abstract

Required attribute. Defines whether or not the class type is abstract or concrete.

Base

Required attribute. Contains the ID of the class type from which the class type inherits.

Hosted

Optional attribute. Defines whether or not this class is hosted. Default value is False.

Singleton

Optional attribute. Defines whether or not this class is a singleton. Default value is False.

Accessibility Attribute Values

Value Description

Public

Indicates that this class type is visible to external management packs for targeting or inheritance.

Internal

Indicates that external management packs cannot reference this class type.

Abstract Attribute Values

Value Description

True

Indicates that this class type cannot be instantiated. Set to True if the intention is to use this class type as a base class only. When used as a base class, all of its properties and relationships are inherited by the derived classes. In addition, any monitors that target the abstract base class are inherited by the derived classes.

False

Indicates that this class type can be instantiated.

Base Attribute Values

Value Description

The ID of a predefined class type.

All defined class types must specify the ID of the class type from which they inherit. Choosing the right base class is critical when authoring a management pack. The following classes are the most commonly used base classes in a management pack and should be considered before choosing anything else.

 

Class Name Library Reference When to use

Microsoft.Windows.ComputerRole

Microsoft.Windows.Library

Use Microsoft.Windows.ComputerRole as a base class when your class type represents a stand-alone application role such as a Web server, ERP system, or infrastructure service and when you want that application’s health to be rolled up into the computer on which it is running.

Microsoft.Windows.LocalApplication

Microsoft.Windows.Library

Use the Microsoft.Windows.LocalApplication as a base class when your class type represents a local application that shares the resources of the hosting Windows computer with other applications. Unlike the Microsoft.Windows.ComputerRole class, the Microsoft.Windows.LocalApplication class type does not automatically roll its health up to the hosting computer.

Microsoft.Windows.ApplicationComponent

Microsoft.Windows.Library

Use the Microsoft.Windows.ApplicationComponent as a base class when your class type represents a component that is dependent on your stand-alone application.

Hosted Attribute Values

Value Description

True

Indicates that this class type is hosted by another class type. Instances of the hosting class must be discovered before instances of this class type can be discovered. For more information about hosting relationships, see Management Pack Classes.

If an instance of the hosting class is to contain more than one instance of this class type, a key property must be defined. If only one instance will be discovered, no key property is required. For more information about key properties, see Property (ClassType).

Note

If the class type does not already inherit a hosting relationship, a RelationshipType element of base class System.Hosting must be defined that describes the hosting class type of the hosted class type.

False

Default value. Indicates that this class type is not hosted by another class type. To ensure uniqueness within the management group, a key property must be defined for this class type unless its base class type already defines one. For more information about key properties, see Property (ClassType).

Singleton Attribute Values

Value Description

True

Indicates that this class type is to be created when the management pack is installed and that only one instantiation will ever exist in the system. A singleton class type never requires a discovery.

False

Indicates that the class requires a discovery for instantiation. Always set to False if there is a possibility that there will be multiple instances of the ClassType element.

Child Elements

Element Description

Property (ClassType)

Optional element if the class type’s Hosted attribute is set to True or if Hosted attribute is set to False and the class type is a singleton. If Hosted is set to False, a key property must be set. For more information about the Key property, see Property (ClassType).

Parent Elements

Element Description

ClassTypes

Contains definitions of class types to be discovered and/or monitored.

Remarks

A class type represents an entity in a service model. Any number of class types can be defined in a management pack. The class types you choose do not represent the object model of your application but rather the objects that are to be targeted for health monitoring. In the Operations Console, class types are referred to as “targets.” All workflows target a specific class type, which means they work within the context of that class type when an instance of that class type exists in the system. For example, when the Microsoft.Windows.OperatingSystem class type is targeted by a rule, that rule will run only when that class type has been discovered in the system.

Class types can have properties that are populated as soon as they are discovered. These properties can be used for informational purposes (users can see these in the console), for monitor configuration, for task configuration, and as criteria for groups, among other things.

A display string for each class type and each property defined within a class type should be defined in the display string section of the management pack for at least one language. For more information, see DisplayStrings.

Whenever a class type instance is discovered, that instance will be displayed in the Operations console. If you do not want your class type to inherit the default image of its base class type, you must create an Image element and associate your class type with that image by defining an ImageReference element.

Example

The following example shows how two abstract classes are defined. The Microsoft.SQLServer.Component class type is created to represent all SQL Server components. It is an abstract class type, which means that it is used solely as a base class type for other class types. The abstract Microsoft.SQLServer.Agent class type derives from the abstract Microsoft.SQLServer.Component class type and provides three properties, one of which is a key to uniquely identify each instance of the class type. The key is required because the parent base class does not provide a key property. For more information about key properties, see Property (ClassType).

<TypeDefinitions> 
 <EntityTypes> 
   <ClassTypes> 
   <ClassType ID="Microsoft.SQLServer.Component" Accessibility="Public" Base="Windows!Microsoft.Windows.ApplicationComponent" Hosted="false" Abstract="true"  Singleton="false"/>        
   <ClassType ID="Microsoft.SQLServer.Agent" Accessibility="Public" Base="Microsoft.SQLServer.Component" Hosted="false" Abstract="true" Singleton="false"> 
    <Property ID="ServiceName" Type="string" Key="true" />
    <Property ID="Account" Type="string" /> 
    <Property ID="DisplayName" Type="string" /> 
   </ClassType> 
  </ClassTypes> 
 </EntityTypes> 
</TypeDefinitions>

See Also

Reference

ClassTypes
DisplayStrings
Image
ImageReference
Property (ClassType)