Share via


Management Pack Health Model Exercise #3 - Creating a Repeating Event Monitor

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



Overview

The following procedure shows how to create a repeating event monitor 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 Revision #1.  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:

  • Runs on any computer that has an instance of MyComputerRole1.
  • Sets the monitor to a critical state when an event in the Application event log with an event source of MyApplication and an event number of 201 is detected 3 times within 5 minutes.
  • Sets the monitor to a healthy state when an event in the Application event log with an event source of MyApplication and an event number of 202 is detected.

Authoring Console Procedure

  1. In the Authoring Console, select Health Model, and then select Monitors.
  2. In the Monitors pane, expand My Application Component, and then expand System.Health.EntityState.
  3. Right-click System.Health.AvailabilityState, select New, select Windows Events, select Repeated, and then select Event Reset.
  4. On the General page, do the following:
    1. In the ElementID box, type MyMP.Monitor.MyApplicationRepeatingEventError.
    2. In the Display Name box, type My Application Repeating Event Error.
    3. In the Target box, select MyMP.MyComputerRole1.
    4. In the Parent Monitor box, select System.Health.AvailabilityState.
    5. In the Category box, select AvailabilityHealth. Click Next.
  5. On the **Repeated Event Log **page, do the following:
    1. In the Log Name box, keep the default value of Application.
    2. Click Next.
  6. On the Repeated Event Log Expression page, do the following:
    1. For the Event ID value, type 201.
    2. For the Event Source value, type MyApplication.
    3. Click Next.
  7. On the Repeated Event Detection page, do the following:
    1. For the Counting Mode, select Trigger on count, sliding.
    2. For the Compare Count, type 3.
    3. Select Based on items occurrence within a time interval.
    4. For the Interval, type 5 and select Minutes.
  8. On the Simple Event Log page, do the following:
    1. In the Log Name box, keep the default value of Application.
    2. Click Next.
  9. On the **Simple Event Log **page, do the following:
    1. For the Event ID value, type 202.
    2. For the Event Source value, type MyApplication.
    3. Click Next.
  10. Expand System.Health.AvailabilityState.
  11. Right-click MyMP.Monitor.MyApplicationRepeatingEventError and select Properties.
  12. On the Health tab, for RepeatedEventRaised, change the Health State to Critical.
  13. On the Alerting tab, check Generate alerts for this monitor.
  14. In the Alert description box, type Event 201 was detected $Data/Context/Count$ times between $Data/Context/TimeWindowStart$ and $Data/Context/TimeWindowEnd$. The first event was at $Data/Context/TimeWindowStart$. The last event was at $Data/Context/TimeWindowEnd$
  15. Click OK.

Visual Studio Authoring Extensions Procedure

  1. 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.
  2. Configure the Monitor Properties:
    1. Right click the entry for NewUnitMonitor and select Properties Window.
    2. Change the ID to Monitor.MyApplicationRepeatingEventError.
    3. Change the Display Name to My Application Repeating Event Error.
  3. Select the Monitor Target:
    1. Select Target and click the ellipse (...) button on the right of the field. 
    2. Select MyMP.MyComputerRole1 and click OK.
  4. Select the Monitor Type:
    1. Select Monitor Type ID and click the ellipse (...) button on the right of the field. 
    2. Select Microsoft.Windows.RepeatedEventLogSingleEventLog2StateMonitorType and click OK.
    3. Select Parent Monitor ID and click the ellipse (...) button on the right of the field.
    4. Select System.Health.AvailabilityState and click OK.
  5. 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    >  
            <    LogName    >Application</    LogName    >  
            <    Expression    >  
                        <      And      >      
                          <      Expression      >      
                            <      SimpleExpression      >      
                              <      ValueExpression      >      
                                <      XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>  
                              </      ValueExpression      >      
                              <      Operator      >Equal</      Operator      >      
                              <      ValueExpression      >      
                                <      Value Type="UnsignedInteger">202</Value>  
                              </      ValueExpression      >      
                            </      SimpleExpression      >      
                          </      Expression      >      
                          <      Expression      >      
                            <      SimpleExpression      >      
                              <      ValueExpression      >      
                                <      XPathQuery Type="String">PublisherName</XPathQuery>  
                              </      ValueExpression      >      
                              <      Operator      >Equal</      Operator      >      
                              <      ValueExpression      >      
                                <      Value Type="String">MyApplication</Value>  
                              </      ValueExpression      >      
                            </      SimpleExpression      >      
                          </      Expression      >      
                        </      And      >      
            </    Expression    >  
            <    RepeatedComputerName    >$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</    RepeatedComputerName    >  
            <    RepeatedLogName    >Application</    RepeatedLogName    >  
            <    RepeatedExpression    >  
                        <      And      >      
                          <      Expression      >      
                            <      SimpleExpression      >      
                              <      ValueExpression      >      
                                <      XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>  
                              </      ValueExpression      >      
                              <      Operator      >Equal</      Operator      >      
                              <      ValueExpression      >      
                                <      Value Type="UnsignedInteger">201</Value>  
                              </      ValueExpression      >      
                            </      SimpleExpression      >      
                          </      Expression      >      
                          <      Expression      >      
                            <      SimpleExpression      >      
                              <      ValueExpression      >      
                                <      XPathQuery Type="String">PublisherName</XPathQuery>  
                              </      ValueExpression      >      
                              <      Operator      >Equal</      Operator      >      
                              <      ValueExpression      >      
                                <      Value Type="String">MyApplication</Value>  
                              </      ValueExpression      >      
                            </      SimpleExpression      >      
                          </      Expression      >      
                        </      And      >      
            </    RepeatedExpression    >  
            <    Consolidator    >  
                        <      ConsolidationProperties />  
                        <      TimeControl      >      
                          <      WithinTimeSchedule      >      
                            <      Interval      >300</      Interval      >      
                          </      WithinTimeSchedule      >      
                        </      TimeControl      >      
                        <      CountingCondition      >      
                          <      Count      >3</      Count      >      
                          <      CountMode      >OnNewItemTestOutputRestart_OnTimerSlideByOne</      CountMode      >      
                        </      CountingCondition      >      
            </    Consolidator    >  
      
    3. Select Monitor Operational States and click the ellipse (...) button on the right of the field.

    4. Next to RepeatedEventRaised, select Critical.

    5. Next to EventRaised, select Healthy.

    6. Click OK,

  6. 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