This document is part of the Operations Manager Management Pack Authoring Guide .
The following procedure shows how to create an event monitor using the Operations Manager 2007 Authoring console and Visual Studio Authoring Extensions that is targeted at a class that has multiple instances on the agent. Because multiple instances are expected, additional criteria is required that includes a property of the target object. This ensures that each copy of the monitor applies to only a single instance of the target class.
This exercise applies to the following products:
Before you perform this procedure, you must first complete the following prerequisite procedures:
The Microsoft System Center team has validated this procedure as of Revision #2. 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
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.
The event monitor created in this procedure has the following characteristics:
<!-- Computer name for the first event. We will use a variable to get the target computer name. -->
<
FirstComputerName
>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</
>
<!-- Name of the log containing the first event. -->
FirstLogName
>Application</
<!-- Expression for the first event -->
FirstExpression
And
<!-- Expression for the first event number -->
Expression
SimpleExpression
ValueExpression
XPathQuery
Type
=
"UnsignedInteger"
>EventDisplayNumber</
</
Operator
>Equal</
Value
>201</
<!-- Expression for the first event source -->
"String"
>PublisherName</
>MyApplication</
> <!-- Expression for the first event parameter --> <Expression> <SimpleExpression> <ValueExpression> <XPathQuery Type="String">Params/Param[1]</XPathQuery> </ValueExpression> <Operator>Equal</Operator> <ValueExpression> <Value Type="String">ComponentName</Value> </ValueExpression> </SimpleExpression> </Expression>
<!-- Expression for the first event parameter -->
>Params/Param[1]</
>ComponentName</
<!-- Computer name for the second event. We will use a variable to get the target computer name. -->
SecondComputerName
SecondLogName
<!-- Expression for the second event -->
SecondExpression
<!-- Expression for the second event number -->
>202</
<!-- Expression for the second event source -->
> <!-- Expression for the second event parameter --> <Expression> <SimpleExpression> <ValueExpression> <XPathQuery Type="String">Params/Param[1]</XPathQuery> </ValueExpression> <Operator>Equal</Operator> <ValueExpression> <Value Type="String">ComponentName</Value> </ValueExpression> </SimpleExpression> </Expression>
<!-- Expression for the second event parameter -->
AndresNa edited Revision 2. Comment: The Details section refers to event IDs 201 and 202 but the code was using events 101 and 102... since those are used in the first event example, I figured the XML was wrong, not the Details section