Share via


Management Pack Health Model Exercise #11 - Creating a WMI Performance Collection Rule

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



Overview

The following procedure shows how to create a WMI performance collection rule 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 rule created in this procedure has the following characteristics:

  • Runs on any computer that has an instance of MyComputerRole1.
  • Collects the size for a file that is named C:\Logs\MyAppFile.txt.

 


Authoring Console Procedure

  1. In the Authoring Console, select Health Model, and then select Rules.
  2. Right-click in the Rules pane, select New, select Collection, select Performance Based, and then select WMI Performance Collection.
  3. On the General page, do the following:
    1. In the ElementID box, type MyMP.Rule.CollectWMIPerformance.
    2. In the Display Name box, type My Application Collect WMI Performance.
    3. In the Target box, select MyMP.MyComputerRole1.
    4. In the Category box, select PerformanceCollection. Click Next.
  4. On the WMI Configuration page, do the following:
    1. In the WMI Namespace box, type root\cimv2.

    2. In the Query box, paste the following WMI query.

       

      Select Name,FileSize From CIM_DataFile Where Name = 'C:\\Logs\\MyAppFile.txt'
      
      
    3. In the Query Interval box, type 900.

    4. Click Next.

  5. On the Performance Mapper page, do the following:
    1. In the Object box, type MyApp.
    2. In the Counter box, type FileSize.
    3. In the Instance box, type $Data/Property[@Name=’Name’]$.
    4. In the Value box, type $Data/Property[@Name=’FileSize’]$.
    5. Click Finish.

 


Visual Studio Authoring Extensions Procedure 

  1. Add a reference to the Data Warehouse 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 Microsoft.SystemCenter.DataWarehouse.Library.mp and click OK.
    5. Click on Microsoft.SystemCenter.DataWarehouse.Library in the Solution Explorer.
    6. In the Properties pane change the **Alias **to  SCDW.
  2. Create the Rule:
    1. In Solution Explorer, right click Rules.mptg and then select Open.
    2. Right click in the  template window and select Add Template
    3. Select Rule (Performance Collection).  
  3. Configure the Rule Properties:
    1. Right click the entry for NewPerformanceCollectionRule and select Properties Window.
    2. Change the ID to Rule.CollectWMIPerformance.
    3. Change the Display Name to My Application Collect WMI Performance.
  4. Select the Rule Target:
    1. Select Target and click the ellipse (...) button on the right of the field. 
    2. Select MyMP.MyComputerRole1 and click OK.
  5. Select the Rule modules:
    1. Select Data Sources and click the ellipse (...) button on the right of the field.

    2. Click Add

    3. Select Data Source Type ID and click the ellipse (...) button on the right of the field.

    4. Select Microsoft.Windows.WmiPerfCounterProvider and click OK.

    5. Select Data Source Configuration and click the ellipse (...) button on the right of the field.

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

      
      
            <    NameSpace    >root\cimv2</    NameSpace    >  
            <    Query    >Select Name,FileSize From CIM_DataFile Where Name = 'C:\\Logs\\MyAppFile.txt'</    Query    >  
            <    Frequency    >900</    Frequency    >  
            <    ObjectName    >MyApp</    ObjectName    >  
            <    CounterName    >FileSize</    CounterName    >  
            <    InstanceName    >$Data/Property[@Name=’Name’]$</    InstanceName    >  
            <    Value    >$Data/Property[@Name=’FileSize’]$</    Value    >  
      
    7. Click OK.

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

See Also