The following procedures show how to create a VBScript script discovery using the Operations Manager 2007 Authoring console and Visual Studio Authoring Extensions. This exercise is part of the System Center Operations Manager Management Pack Authoring Center.
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 #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
The discovery created in this procedure has the following characteristics:
SourceId = WScript.Arguments(0)
ManagedEntityId = WScript.Arguments(1)
sComputerName = WScript.Arguments(2)
Set
oAPI = CreateObject(
"MOM.ScriptAPI"
)
oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
For
i = 1 to 3
oInstance = oDiscoveryData.CreateClassInstance(
"$MPElement[Name='MyMP.MyApplicationComponent']$"
oInstance.AddProperty
"$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$"
, sComputerName
"$MPElement[Name='MyMP.MyApplicationComponent']/ComponentName$"
,
"Component"
& i
oDiscoveryData.AddInstance(oInstance)
Next
oAPI.
Return
(oDiscoveryData)
<!-- IntervalSeconds specifies how often we will run the discovery. -->
<
IntervalSeconds
>14400</
>
<!-- SyncTime specifies the minutes after the hour to synchronize execution of the discovery. -->
SyncTime
/>
<!-- ScriptName specifies the name of the script. -->
ScriptName
>DiscoverApplicationComponents.vbs</
<!-- Arguments specifies the arguments to pass into the script. -->
<!-- A discovery script will always include $MPElement and $Target/ID$ in addition to any other values and variables the script requires. -->
Arguments
>$MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</
<!-- ScriptBody is the text of the script. In this case, a variable is used to specify the script file in the VSAE project -->
ScriptBody
>$IncludeFileContent/DiscoverApplicationComponents.vbs$</
<!-- TimeoutSeconds is the seconds that the script must be running before it is automatically ended. -->
TimeoutSeconds
>300</
Richard Mueller edited Revision 3. Comment: Removed blank headings and fixed duplicate <a name> tags in HTML
Richard Mueller edited Revision 2. Comment: Removed (en-US) from title, added tags
brian, after no problems in exercises 1-5, this one is giving me trouble. steps 2 through 6 always result in:
Failed to verify Discovery [ManagementPack3.Discovery.MyApplicationComponent.VBScript]
Failed to verify referenced module : ID=DSInvalid configuration specified for Module [DS]Cannot find specified MPSubElement : ComponentName, (on MPElement= MyMP.MyApplicationComponent) specified in expression: $MPElement[Name='MyMP.MyApplicationComponent']/ComponentName$
in exercise 1, i think you left out the "componentname" element creation in the VSAE instructions (it's in the authoring console instructions)
You're absolutely right. It is a problem with exercise #1. I fixed it by adding in the ComponentName.