Share via


Management Pack Health Model Exercise #6 - Creating a Consecutive Sample Performance Counter

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 performance monitor created in this procedure has the following characteristics:

  • Measures the Memory\Available MBytes performance counter.
  • The performance counter is measured every 15 minutes.
  • If 4 consecutive performance measurements are below 100 MBytes, the monitor turns critical.

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. Add a reference to the Performance Library management pack:
    1. In Solution Explorer, right click References and then select Add Reference.
    2. Select the Browse tab.
    3. Navigate to C:\Program Files (x86)\System Center 2012 Visual Studio Authoring Extensions\References\OM2007R2\System.Performance.Library.mp.  You may need to modify this path based on your installation location of VSAE.
    4. Select System.Performance.Library.mp and click OK.
  2. Create the Monitor:
    1. In Solution Explorer, right click Monitors.mptg and then select Open.
    2. Right click in the  template window and select Add Template.
    3. Change the name of the template to Monitors.mptg and click Add.
    4. Select Monitor (Unit) and click OK.
  3. Configure the Monitor Properties:
    1. Right click the entry for NewUnitMonitor and select Properties Window.
    2. Change the ID to Monitor.MyApplicationConsecutiveSampleMonitor.
    3. Change the Display Name to My Application Consecutive Sample Monitor.
  4. Select the Monitor Target:
    1. Select Target and click the ellipse (...) button on the right of the field. 
    2. Select ****MyMP.MyComputerRole1and click OK.
  5. Select the Monitor Type:
    1. Select Monitor Type ID and click the ellipse (...) button on the right of the field. 
    2. Select System.Performance.ConsecutiveSamplesThreshold and click OK.
    3. Select Parent Monitor ID and click the ellipse (...) button on the right of the field.
    4. Select System.Health.PerformanceState and click OK.
  6. Configure the Monitor:
    1. Select Monitor Configuration and click the ellipse (...) button on the right of the field. 

    2. Copy the following XML into the configuration window between the <Configuration> tags.  Note that you can use Intellisense to manually type in each entry.
           

      
      
            <    ComputerName    >$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</    ComputerName    >  
            <    CounterName    >Available MBytes</    CounterName    >  
            <    ObjectName    >Memory</    ObjectName    >  
            <    InstanceName />
            <    AllInstances    >false</    AllInstances    >  
            <    Frequency    >900</    Frequency    >  
            <    Threshold    >100</    Threshold    >  
            <    Direction    >less</    Direction    >  
            <    NumSamples    >4</    NumSamples    >  
      
      
      
    3. Select Monitor Operational States and click the ellipse (...) button on the right of the field.

    4. Next to ConditionTrue, select Critical.

    5. Next to ConditionFalse, select Healthy.

    6. Click OK,

  7. Save and Compile the Project:
    1. Select File, and then click Save Monitors.mptg.
    2. Select Build and then Build Solution.
    3. Ensure that you don't receive any errors.

See Also