Create a Recovery Task

Applies To: Operations Manager 2007 R2

Not all alerts require direct administrative attention to resolve. For example, you can easily deploy an updated script across all computers by using a recovery task. A task can be initiated automatically from a monitor that detects the problem.

Creating a Recovery Task to Replace a File

When the Sample Health Script fails MD5 validation, a recovery task can be triggered to automatically deploy a new copy of the script.

    <Recoveries>
      <Recovery ID="Microsoft.SCX.Authoring.Guide.CheckMd5Script.Recovery" Accessibility="Public" Enabled="true" Target="Microsoft.SCX.Sample.Application" Monitor="Microsoft.SCX.Authoring.Guide.CheckMd5Script.Monitor" ResetMonitor="false" ExecuteOnState="Error" Remotable="true" Timeout="300">
        <Category>Maintenance</Category>
        <WriteAction ID="CopyScript" TypeID="Unix!Microsoft.Unix.SFTPTransfer.WriteAction">
          <Host>$Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Host>
          <Port>>$Host/Property[Type="Unix!Microsoft.Unix.Computer"]/SSHPort$</Port>
          <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>
          <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>
          <SourceFile>C:\SampleScripts\SampleAppHealth.sh</SourceFile>
          <TargetFile>/tmp/SampleAppHealth.sh</TargetFile>
          <TimeoutSeconds>30</TimeoutSeconds>
        </WriteAction>
      </Recovery>
    </Recoveries>

The recovery task goes into the monitoring section, immediately following the monitors subsection.

A write action is performed to copy the script in the C:\SampleScripts\ directory on the Operations Manager management server. This is then copied to the /tmp directory on the targeted system. When this task is run, the associated Health Monitor is run, again confirming that the script is valid and then performing the Health script evaluation.

Recovery requires that a display string be added to the language packs section.

        <DisplayString ElementID="Microsoft.SCX.Authoring.Guide.CheckMd5Script.Recovery">
          <Name>MD5 Hash Recovery Task</Name>
          <Description />
        </DisplayString>

The MD5 value that is found in the Monitor must be updated to correspond to the new hash value or the MD5 validation continues to fail.

Save the file as Microsoft.SCX.Authoring.Guide.xml and then import the updated management pack into the management group, as described in Required Management Pack Definitions topic.

Customization of Recovery

This recovery is identical to the task that is defined in the Create Tasks topic, except that the recovery is invoked automatically when the parameter for AutoResolve in the script monitor is set to true. See the Use a Script to Monitor an Application topic for additional information.