Share via


Management Pack Health Model Exercise #8 - Creating a Diagnostic

This document is part of the Operations Manager Management Pack Authoring Guide



Overview

The following procedure shows how to create  a diagnostic that runs a command using the Operations Manager 2007 Authoring console and Visual Studio Authoring Extensions.

Product Versions

This exercise applies to the following products:

  • System Center Operations Manager 2007 R2
  • System Center 2012 Operations Manager
  • System Center 2012 Operations Manager SP1

Prerequisites

Before you perform this procedure, you must first complete the following prerequisite procedures:

Revisions

The Microsoft System Center team has validated this procedure as of the original revision.  We will continue to review any changes and periodically provide validations on later revisions as they are made.  Please feel free to make any corrections or additions to this procedure that you think would assist other users

Sample Code

A sample of the completed code for each exercise is available in the TechNet Gallery.  There is a separate sample for each exercise that includes the management pack completed at the end of that exercise and each preceding exercise.  This strategy allows you to work through each exercise in order and then compare your results.  For VSAE, this also includes the Visual Studio solution. 

Details

The event monitor created in this procedure has the following characteristics:

  • Automatically runs when the MyMP.Monitor.MyApplicationEventError monitor goes to a critical state.
  • Runs tasklist.exe to return a list of running processes on the agent computer.

Authoring Console Procedure

  1. In the Authoring Console, select Health Model, and then select Monitors.
  2. In the Monitors pane, expand MyMP.MyComputerRole1, and then expand System.Health.EntityState, and then expand System.Health.AvailabilityState.
  3. Right-click MyMP.Monitor.MyApplicationEventError and select Properties.
  4. Select the Diagnostic and Recovery tab.
  5.  Click Add and then Diagnostic for a critical health state.
  6. In the Choose a unique identifier box, type MyMP.MyApplicationEventError.CommandDiagnostic and then click OK.
  7. On the General tab, do the following:
    1. In the Name box**,** type Check Running Processes.
    2. In the Target box, select MyMP.MyComputerRole1.
  8. On the Configuration tab, do the following:
    1. Under Actions, click Create.
    2. In the Choose Module Type box, select System.CommandExecutorProbe.
    3. In the Module ID box**,** type Command. Click OK.
    4. Click Edit.
    5. Click Configure.
    6. In the Full path to file box, type %windir%\system32\tasklist.exe.
    7. Click OK.
    8. Click OK.
    9. Click OK.
    10. Click OK

 


Visual Studio Authoring Extensions Procedure

  1. Create the Diagnostic:
    1. In Solution Explorer, right click Right click the name of the solution, select Add and then select New Item.
    2. Select Monitor Diagnostic and click OK.
    3. Change the name of the template to Diagnostics.mpx and click Add.
  2. Configure the Diagnostic:
    1. Replace the value for the ID attribute of the Diagnotic with MyMP.MyApplicationEventError.CommandDiagnostic
    2. In the Target attribute for the Diagnostic, fill in MyMP.MyComputerRole1
    3. In the Monitor attribute for the Diagnostic, fill in MyMP.Monitor.MyApplicationEventError.
  3. Configure the Diagnostic modules:
    1. Remove the ConditionDetection section of the XML.

    2. Replace the XML for the ProbectAction with the following XML.  Note that you can use Intellisense to manually type in each entry.

      <ProbeAction ID="Command" TypeID="System!System.CommandExecuterProbe">
        <ApplicationName><![CDATA[%windir%\system32\tasklist.exe]]></ApplicationName>
        <WorkingDirectory />
        <CommandLine />
        <TimeoutSeconds>15</TimeoutSeconds>
        <RequireOutput>true</RequireOutput>
      </ProbeAction>
      
      
  4. Configure the Display String:
    1. Replace the value for the ElementID attribute of the DisplayString with MyMP.MyApplicationEventError.CommandDiagnostic.
    2. Replace the value for the Name element with Check Running Processes.
  5. Save and Compile the Project:
    1. Select File, and then click Save Diagnostics.mpx.
    2. Select Build and then Build Solution.
    3. Ensure that you don't receive any errors.

See Also