Recovery

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

Represents a recovery definition associated with a specific monitor.

Schema Hierarchy

ManagementPack
  Monitoring
    Recoveries
      Recovery

Syntax

<Recovery ID=”DiagnosticID” Comment=”Comment” Accessibility=”Public/Internal” Enabled=”True/False” Target=”TargetClassID” Monitor=”MonitorID” ExecuteOnState=”Warning/Error” ResetMonitor=”True/False” Remotable=”True/False” Timeout=”300”>
   <Category>CategoryName</Category>
   <ConditionDetection>…</ConditionDetection>
   <WriteAction>…</WriteAction>
</Recovery>

Attributes and Elements

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

Enabled

Required attribute. Defines whether or not this workflow is, by default, enabled or disabled.

Target

Required attribute. The ID of the targeted class type of the associated monitor.

Monitor

Required attribute. The ID of the monitor that is associated with recovery.

ExecuteOnDiagnostic

The ID of the Diagnostic for which this recovery will run. This recovery will run if the diagnostic outputs a data item.

ExecuteOnState

Required attribute if ExecuteOnDiagnostic is not set. If ExecuteOnDiagnostic is set, this attribute cannot be set. Defines the health state at which the diagnostic workflow is to be run.

Remotable

Optional attribute. Defines whether or not this workflow will run for agentless monitoring. Default value is true.

ResetMonitor

Required attribute. Defines whether to reset the monitor when the recovery runs. Set to true or false. The associated monitor must have on-demand detection workflows defined or a no-detection state. Otherwise, reset will do nothing.

Timeout

Required attribute. The time, in seconds, that the diagnostic can run. The diagnostic will be terminated if it exceeds this limit.

Enabled Attribute Values

Value Description

True

The workflow is enabled and will run when its target class has been discovered.

False

The workflow is disabled and will not run even when its target class has been discovered.

ExecuteOnState Attribute Values

Value Description

Error

Indicates that the diagnostic will run when the associated monitor attains an Error state.

Warning

Indicates that the diagnostic will run when the associated monitor attains a Warning state.

Child Elements

Element Description

Category (Recovery)

Represents the category name of a recovery.

ConditionDetection (Recovery)

Optional element. Represents an implementation of a condition detection module type definition.

WriteAction (Recovery)

Required element. Represents an implementation of a write action module type definition.

Parent Elements

Element Description

Recoveries

Contains diagnostic definitions targeted at a specific monitor in the health model.

Remarks

Recoveries are workflows that are used to perform a recovery action on the system. Recoveries can be associated with a diagnostic to be run only when the diagnostic specified in the ExecuteOnDiagnostic attribute outputs a data item, or they may be automatically run if the monitor has reached the associated state specified in the ExecuteOnState attribute. Both attributes are mutually exclusive. Unlike diagnostics, recoveries do change the state of the system. The output of the workflow will be sent to the database where it can be viewed from within the health explorer.

Recovery workflows receive either the data item that caused the state change of the monitor or the data item that is outputted by a diagnostic. A ConditionDetection (Recovery) module can be added to a recovery to filter on the diagnostic output and determine whether to proceed with the recovery WriteAction (Recovery) operation. See the sample XML at the end of this topic.

Recoveries can also be run on-demand. To create a purely on-demand recovery, make sure that the recovery is disabled.

Example

The following XML sample illustrates a recovery that restarts a service when the Microsoft.Windows.HyperV.2008.Services.ImageManagementServiceMonitor monitor reaches an Error health state.

<Recovery ID="Microsoft.Windows.HyperV.2008.Services.ImageManagementServiceRestart" Accessibility="Internal" Enabled="True" Target="HVDisc!Microsoft.Windows.HyperV.2008.ServerRole" Monitor="Microsoft.Windows.HyperV.2008.Services.ImageManagementServiceMonitor" ResetMonitor="false" ExecuteOnState="Error" Remotable="true" Timeout="300">
  <Category>Maintenance</Category>
  <WriteAction ID="RestartService" TypeID="Windows!Microsoft.Windows.ServiceControlManager.StartService" RunAs="System!System.PrivilegedMonitoringAccount">
    <ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</ComputerName>
    <ServiceName>vhdsvc</ServiceName>
  </WriteAction>
</Recovery>

The following XML sample illustrates how a condition detection module can be used to filter diagnostic input data to determine whether the write action should be run.

<Recovery ID="Microsoft.SystemCenter.ConfigService.Recovery.StartConfigService" Comment="Start config service" Accessibility="Internal" Enabled="false" Target="SCLibrary!Microsoft.SystemCenter.RootManagementServer" Monitor="Microsoft.SystemCenter.ConfigurationService.ServiceMonitor" ResetMonitor="true" ExecuteOnDiagnostic="Microsoft.SystemCenter.ConfigService.Diagnostic.QueryConfigService" Remotable="true" Timeout="300">
  <Category>Maintenance</Category>
  <ConditionDetection ID="Filter" TypeID="System!System.ExpressionFilter">
    <Expression>
      <And>
        <Expression>
          <SimpleExpression>
            <ValueExpression>
              <XPathQuery>Diagnostic/DataItem/Property[@Name='State']</XPathQuery>
            </ValueExpression>
            <Operator>Equal</Operator>
            <ValueExpression>
              <Value Type="Integer">1</Value>
            </ValueExpression>
          </SimpleExpression>
        </Expression>
        <Expression>
          <SimpleExpression>
            <ValueExpression>
              <XPathQuery>Diagnostic/DataItem/Property[@Name='StartMode']</XPathQuery>
            </ValueExpression>
            <Operator>NotEqual</Operator>
            <ValueExpression>
              <Value Type="Integer">4</Value>
            </ValueExpression>
          </SimpleExpression>
        </Expression>
      </And>
    </Expression>
  </ConditionDetection>
  <WriteAction ID="StartService" RunAs="SCLibrary!Microsoft.SystemCenter.AgentManagementAccount" TypeID="Windows!Microsoft.Windows.ServiceControlManager.StartService">
    <ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</ComputerName>
    <ServiceName>OMCFG</ServiceName>
  </WriteAction>
</Recovery>

A condition detection module can be included to filter the incoming data item. The data type for the incoming data item is MonitorTaskDataType.

The following XML sample illustrates a recovery that contains a condition detection module.

<Recovery ID="Microsoft.Windows.NetworkLoadBalancing.Library.StartNodeRecovery" Accessibility="Internal" Enabled="false" Target="Microsoft.Windows.NetworkLoadBalancing.ServerRole" Monitor="Microsoft.Windows.NetworkLoadBalancing.ServerRoleDependsOnAnotherServerRole" ResetMonitor="false" ExecuteOnState="Success" Remotable="false" Timeout="300">
  <Category>Custom</Category>
  <ConditionDetection ID="Filter" TypeID="System!System.ExpressionFilter">
    <Expression>
      <SimpleExpression>
        <ValueExpression>
          <XPathQuery>StateChange/DataItem/OldHealthState</XPathQuery>
        </ValueExpression>
        <Operator>Equal</Operator>
        <ValueExpression>
          <Value Type="Integer">3</Value>
        </ValueExpression>
      </SimpleExpression>
    </Expression>
  </ConditionDetection>
  <WriteAction ID="WA" TypeID="Microsoft.Windows.NetworkLoadBalancing.ControlNode.WriteAction">
    <NodeName>$Target/Property[Type="Microsoft.Windows.NetworkLoadBalancing.ServerRole"]/NodeName$</NodeName>     <ComputerPrincipalName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</ComputerPrincipalName>
    <TimeoutSeconds>300</TimeoutSeconds>
    <Command>Start</Command>
    <EventID>6101</EventID>
    <EventMessage>"Starting NLB node because the load balanced application returned to a healthy state."</EventMessage>
  </WriteAction>
</Recovery>

See Also

Reference

Diagnostic
Recoveries