This document is part of the Operations Manager Management Pack Authoring Guide .
The following procedure shows how to create an event collection rule by using a monitoring script in the Operations Manager 2007 Authoring console and Visual Studio Authoring Extensions.
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 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
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 rule created in this procedure has the following characteristics:
sComputerName = WScript.Arguments(0) sVersion = WScript.Arguments(1) Set oAPI = CreateObject("MOM.ScriptAPI") Set oBag = oAPI.CreatePropertyBag() Call oBag.AddValue("ComputerName",sComputerName) Call oBag.AddValue("EventID",100) Call oBag.AddValue("ParamValue","Param1") oAPI.Return(oBag)
sComputerName = WScript.Arguments(0)
sVersion = WScript.Arguments(1)
Set
oAPI = CreateObject(
"MOM.ScriptAPI"
)
oBag = oAPI.CreatePropertyBag()
Call
oBag.AddValue(
"ComputerName"
,sComputerName)
"EventID"
,100)
"ParamValue"
,
"Param1"
oAPI.
Return
(oBag)
<IntervalSeconds>900</IntervalSeconds> <SyncTime /> <ScriptName>MyEventCollectionScript.vbs</ScriptName> <Arguments>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="MyMP.MyComputerRoleBase"]/Version$</Arguments> <ScriptBody>$IncludeFileContent/MyEventCollectionScript.vbs$</ScriptBody> <TimeoutSeconds>60</TimeoutSeconds> <EventOriginId>$MPElement$</EventOriginId> <PublisherId>$MPElement$</PublisherId> <PublisherName>MyApp</PublisherName> <Channel>CustomScript</Channel> <LoggingComputer>$Data/Property[@Name='ComputerName']$</LoggingComputer> <EventNumber>$Data/Property[@Name='EventID']$</EventNumber> <EventCategory /> <EventLevel>4</EventLevel> <UserName /> <Params> <Param>$Data/Property[@Name='ParamValue']$</Param> </Params>
<
IntervalSeconds
>900</
>
SyncTime
/>
ScriptName
>MyEventCollectionScript.vbs</
Arguments
>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="MyMP.MyComputerRoleBase"]/Version$</
ScriptBody
>$IncludeFileContent/MyEventCollectionScript.vbs$</
TimeoutSeconds
>60</
EventOriginId
>$MPElement$</
PublisherId
PublisherName
>MyApp</
Channel
>CustomScript</
LoggingComputer
>$Data/Property[@Name='ComputerName']$</
EventNumber
>$Data/Property[@Name='EventID']$</
EventCategory
EventLevel
>4</
UserName
Params
Param
>$Data/Property[@Name='ParamValue']$</
</