MOMScriptAPI.CreateTypedPropertyBag Method
Applies To: Operations Manager 2007 R2, Operations Manager 2007 SP1, System Center Operations Manager 2007
Creates a new MOMPropertyBag object that is used to temporarily store operations data (such as discovery, event, alert or performance data) as a collection of name-value pairs. The property bag object supports only one type of conversion, allowing for conversion type checking within mapping modules.
MOMScriptAPI.CreateTypedPropertyBag(type)
Parameters
Parameter | Type | Description |
---|---|---|
type |
long |
The type of conversion. |
Return Value
Type | Description |
---|---|
Object |
A new instance of a MOMPropertyBag object. |
Remarks
A script uses a property bag to store output data that will be used by subsequent modules. The four possible usages of property bags are:
Map data to a performance point and store in the database.
Map data to an event and store in the database.
Use data to evaluate state as part of a monitor.
Use data to an alert and store in the database.
The following table displays the valid values for the type parameter:
Value | Definition |
---|---|
0 |
Alert Data |
1 |
Event Data |
2 |
Performance Data |
3 |
State Data |
Important
With the current release of Operations Manager 2007, the only modules that use the conversion type check are the mapping modules that perform conversion to event and performance data. For more information about mapping modules please see How to Use Monitoring Data in a Management Pack .
Requirements
Platforms: Requires Windows Server 2003, Windows Vista, or Windows Server 2008
Version: Requires Operations Manager 2007
Example
The following example creates two MOMPropertyBag objects with data that maps to performance data. After the example adds the objects to the internal array of the MOMScriptAPI object, it then submits them to Operations Manager.
Dim pathDB
Dim sizeDB
Dim freespaceDB
Dim oAPI
Set oAPI = CreateObject("MOM.ScriptAPI")
Set objAD = CreateObject("McActiveDir.ActiveDirectory")
objAD.Server = "ComputerName"
If objAD.GetDatabaseInfo(pathDB, sizeDB, freespaceDB) Then
pathDB = LCase(pathDB)
Set oBag = oAPI.CreateTypedPropertyBag(2)
oBag.AddValue "StatusCounter" , "Database Drive Free Space"
oBag.AddValue "StatusInstance", pathDB
oBag.AddValue "StatusValue", "" & freespaceDB
oAPI.AddItem oBag
Set oBag = oAPI.CreateTypedPropertyBag(2)
oBag.AddValue "StatusCounter" , "Database Size"
oBag.AddValue "StatusInstance" , pathDB
oBag.AddValue "StatusValue", "" & sizeDB
oAPI.AddItem oBag
End If
Call oAPI.ReturnItems
The following example shows the XML for a data-mapping condition-detector module. This module allows the MOMPropertyBag object data to be converted into performance data that can be stored in the Operations Manager database.
<ConditionDetection ID=�PerfMapper� TypeID=�SystemPerf!System.Performance.DataGenericMapper�>
<ObjectName>Ad Storage</ObjectName>
<CounterName>$Data/Property[@Name=�StatusCounter�]$</CounterName>
<InstanceName>$Data/Property[@Name=�StatusInstance�]$</InstanceName>
<Value>$Data/Property[@Name=�StatusValue�]$</Value>
</ConditionDetection>
See Also
Reference
MOMScriptAPI Object
MOMPropertyBag Object
MOMScriptAPI.CreatePropertyBag Method
MOMScriptAPI.CreateTypedPropertyBag Method