Share via


Microsoft.Windows.NTServiceStateProvider

Applies To: Operations Manager 2007 R2

The Microsoft.Windows.NTServiceStateProvider data source module type provides the state information of a specific Windows NT service. The module returns System.PropertyBagData data.

Usage

Use this module to provide information regarding a specific Windows NT service in the context of a workflow.

Type Definition

<DataSourceModuleType ID="Microsoft.Windows.NTServiceStateProvider" Accessibility="Public">
  <Configuration>
    <xsd:element name="Computer" type="xsd:string" />
    <xsd:element name="ServiceName" type="xsd:string" />
  </Configuration>
  <ModuleImplementation>
    <Native>
      <ClassID>47AA3039-7E86-4b81-B295-67187EDFF3D7</ClassID>
    </Native>
  </ModuleImplementation>
  <OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>

Parameters

The Microsoft.Windows.NTServiceStateProvider module supports the configuration parameters described in the following table.

Parameter Type Description

ComputerName

String

The name of the computer to query.

ServiceName

String

The service name to query.

For information about the ComputerName parameter, see Microsoft.Windows.Win32ServiceInformationProbe.

Composition

The Microsoft.Windows.NTServiceStateProvider module is a native module.

Module Type Usage

Microsoft.Windows.Win32ServiceInformationProbe

Provides the state information of a specific installed or not installed Win32 service.

Microsoft.Windows.ExistingWin32ServiceInformationProbe[]

Provides the state information of a specific installed Win32 service.

External Module References

None.

Remarks

The module outputs a property bag object that contains data about the service that was queried. The following code example shows an example data item:

<DataItem type="System.PropertyBagData" time="2008-10-08T15:52:27.0027578-07:00" sourceHealthServiceId="B0BE86FA-56AD-1F2E-EE87-8DF72FC53818">
  <Property Name="State" VariantType="3">4</Property>
  <Property Name="ServiceType" VariantType="3">16</Property>
  <Property Name="StartMode" VariantType="3">2</Property>
  <Property Name="ErrorControl" VariantType="3">1</Property>
  <Property Name="TagId" VariantType="3">0</Property>
  <Property Name="ProcessId" VariantType="3">1880</Property>
  <Property Name="Name" VariantType="8">MSSQLSERVER</Property>
  <Property Name="BinaryPathName" VariantType="8">"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe" -sMSSQLSERVER</Property>
  <Property Name="LoadOrderGroup" VariantType="8"></Property>
  <Property Name="Dependencies" VariantType="8"></Property>
  <Property Name="ServiceStartName" VariantType="8">LocalSystem</Property>
  <Property Name="DisplayName" VariantType="8">SQL Server (MSSQLSERVER)</Property>
  <Property Name="Description" VariantType="8">Provides storage, processing and controlled access of data and rapid transaction processing.</Property>
</DataItem>

The data item is a property bag that contains the properties described in the following table.

Property Description

State

The current service status. Possible values are:

  • 0—Unknown

  • 1—Stopped

  • 2—Start pending

  • 3—Stop pending

  • 4—Running

  • 5—Continue pending

  • 6—Pause pending

  • 7—Paused

  • 8—Service not found

  • 9—Server not found

ServiceType

The type of service. Possible values are:

  • 1—Kernel/driver

  • 2—File system driver

  • 16—Own process

  • 32—Share process

StartMode

The startup type of the service. Possible values are:

  • 0—Boot start

  • 1—System start

  • 2—Automatic

  • 3—Manual

  • 4—Disabled

ErrorControl

Severity of the error and the action taken if the service fails to start. Possible values are:

  • 0—The startup (boot) program logs the error but continues the startup operation.

  • 1—The startup program logs the error and displays a message but continues the startup operation.

  • 2: The startup program logs the error. If the last-known good configuration is being started, the startup operation continues. Otherwise, the system is restarted with the last-known-good configuration.

  • 3—The startup program logs the error, if possible. If the last-known good configuration is being started, the startup operation fails. Otherwise, the system is restarted with the last-known good configuration.

TagID

Unique tag value for this service in the group that is specified by the lpLoadOrderGroup parameter. A value of zero indicates that the service has not been assigned a tag.

ProcessID

The current process ID for the service. This is 0 if the service is not currently running.

Name

The short service name—for example: MSSQLSERVER

BinaryPathName

The path to the executable file for the service, including startup parameters.

LoadOrderGroup

Pointer to a null-terminated string that names the load ordering group to which this service belongs. If the member is NULL or an empty string, the service does not belong to a load ordering group.

Dependencies

The short service name of services that are dependencies before this service can start.

ServiceStartName

The logon account for the service or LocalSystem.

DisplayName

The full display name for the service—for example: SQL Server (MSSQLSERVER).

Description

The full description for the service.

Sample

The following example code shows a rule that checks the service state of an NT service and generates an alert if the service is not running:

<Rule ID="Microsoft.Samples.ReadSysLog" Target="Microsoft.Windows.Server.2000.Computer" Enabled="true" ConfirmDelivery="true">
  <Category>Custom</Category>
  <DataSources>
    <DataSource ID="SR" TypeID="AppLog!System.ApplicationLog.NTServiceStateProvider">
      <ComputerName>$Target/Host/Property[Type='Windows!Microsoft. Windows.Server.2000.Computer’]/NetworkName$</ComputerName>
      <ServiceName>SomeNTService</ServiceName>
    </DataSource>
  </DataSources>
  <ConditionDetection ID="Filter" TypeID="System!System.ExpressionFilter">
    <Expression>
      <SimpleExpression>
        <ValueExpression>
          <XPathQuery Type="Integer">State</XPathQuery>
        </ValueExpression>
        <Operator>Equal</Operator>
        <ValueExpression>
          <Value>1</Value>
        </ValueExpression>
      </SimpleExpression>
    </Expression>
  </ConditionDetection>
  <WriteActions>
    <WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
      <Priority>1</Priority>
      <Severity>1</Severity>
      <AlertMessageId>$MPElement[Name="Microsoft.Samples.AlertMessage"]$</AlertMessageId>
      <Suppression>
        <SuppressionValue />
      </Suppression>
    </WriteAction>
  </WriteActions>
</Rule>

Information

   

Module Type

DataSourceModuleType

Input Type

None

Output Type

System.PropertyBagData

Implementation

Native

Library

Microsoft.Windows.Library