Set oDiscoveryData = oAPI.CreateDiscoveryData(0, sourceID, managedEntityID)
'On error resume next
If (CreateAllHwComponentsGroup1() > 0) Then
Call LogDebugString("Created Management Target", INFO_LEVEL)
End If
Call oAPI.Return(oDiscoveryData)
End Sub
'===========================================================================================
' Base Hardware Components
'===========================================================================================
'Create Instances for All Base Hardware Components
Function CreateAllHwComponentsGroup1()
'=========================== Create Instances for All Physical Memory =========================
Function CreateAllPhysicalMemoryInstances()
Call LogDebugString("Entering CreateAllPhysicalMemoryInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oPMTargetCollection, iResult
CreateAllPhysicalMemoryInstances = -1
'Getting Physical Memory's instance
iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, PHYSICAL_MEMORY_IBMSD_CLASS, oPMTargetCollection)
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
'for fee
For Each oObjectItem in oPMTargetCollection
CreateOnePhysicalMemoryInstance(oObjectItem)
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' call CreateNonLicensedMemoryInst()
Else
Call LogDebugString("Can not get Physical Memory collection instance", WARNING_LEVEL)
End If
CreateAllPhysicalMemoryInstances = 1
End Function
Function CreateOnePhysicalMemoryInstance(ByVal oObjectItem)
Call LogDebugString("Entering CreateOnePhysicalMemoryInstance", INFO_LEVEL_FUNCTION)
CreateOnePhysicalMemoryInstance = -1
Dim oPMTargetInstance
Set oPMTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.PhysicalMemory']$")
Call LogDebugString("Created a physical memory instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oPMTargetInstance)
CreateOnePhysicalMemoryInstance = 1
End Function
Function UpdatePhysicalMemoryProperty(ByRef oPMInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdatePhysicalMemoryProperty", INFO_LEVEL_FUNCTION)
Dim oTag, sBankLabel, oPropertyValue
oTag = "Unknown"
sBankLabel = "Unknown"
ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oTag = oObjectItem.Tag
sBankLabel = CStr(oObjectItem.BankLabel)
ON ERROR GOTO 0 ' Break on errors here on.
Call oPMInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", oTag)
Call oPMInstance.AddProperty("$MPElement[Name='IBM.SystemX.PhysicalMemory']/SlotLocation$", sBankLabel)
End Function
Function CreateNonLicensedMemoryInst()
Call LogDebugString("Entering CreateNonLicensedMemoryInst", INFO_LEVEL_FUNCTION)
CreateNonLicensedMemoryInst = -1
Dim oPMInstance
Set oPMInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.PhysicalMemory']$")
Call LogDebugString("Created a physical memory instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oPMInstance)
CreateNonLicensedMemoryInst = 1
End Function
'=========================== Create Instances for All Network Device =========================
Function CreateAllNetworkDeviceInstances()
Call LogDebugString("Entering CreateAllNetworkDeviceInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oNICTargetCollection, iResult
CreateAllNetworkDeviceInstances = -1
'Getting NIC's instance
'iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, NETWORK_ADAPTER_IBMSD_CLASS, oNICTargetCollection)
iResult = GetWMIObjectCollection(IBMSE_NAMESPACE, NETWORK_ADAPTER_IBMSE_CLASS, oNICTargetCollection)
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
For Each oObjectItem in oNICTargetCollection
CreateNIC(oObjectItem)
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' Call CreateNonLicensedNIC()
Else
Call LogDebugString("Can not get NIC collection instance", WARNING_LEVEL)
End If
CreateAllNetworkDeviceInstances = 1
End Function
Function CreateNIC(ByVal oObjectItem)
Call LogDebugString("Entering CreateNIC", INFO_LEVEL_FUNCTION)
CreateNIC = -1
Dim oNICTargetInstance, oHWSystemHostsMTargetRelation, oPropertyValue
Set oNICTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.NetworkDevice']$")
ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oManufacturer = CStr(oObjectItem.Manufacturer)
oDescription = CStr(oObjectItem.Name)
oStatus = CStr(oObjectItem.Status)
If(IsRegExpMatched(agentVersion, "^5\.")) Then
oName = oDescription
Else
'Director 6.1.1 and later: what's different here??? isn't it all ended up with the value of oObjectItem.Name???
'oName = ChangeString(CStr(oObjectItem.Name))
oName = CStr(oObjectItem.Name)
End If
Function CreateNonLicensedNIC()
Call LogDebugString("Entering CreateNonLicensedNIC", INFO_LEVEL_FUNCTION)
CreateNonLicensedNIC = -1
Dim oNICTargetInstance, oHWSystemHostsMTargetRelation, oPropertyValue
Set oNICTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.NetworkDevice']$")
'=========================== Create THE All ServeRAID Device Instance =========================
Function CreateTheAllServeRAIDDeviceInstance()
Call LogDebugString("Entering CreateTheAllServeRAIDDeviceInstance (Adaptec)", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oServeRAIDDeviceCollection, iResult, oServeRAIDInstance, oPropertyValue
CreateTheAllServeRAIDDeviceInstance = -1
'Getting ServeRAID's instance in root/adpt
If (IsRegExpMatched(agentVersion, "^5\.1")) Then
'Director Core Service 5.10.x
iResult = GetWMIObjectCollection("root/ibmsd", "IBMPSG_ServeRAIDController", oServeRAIDDeviceCollection)
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
'Got the ServeRAID Controller's instances
For Each oObjectItem in oServeRAIDDeviceCollection
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.ServeRAIDDevice.For.DirectorAgent.5.1x']$")
Call UpdateServeRAIDProperty(oServeRAIDInstance, oObjectItem, agentVersion)
Call BindHosterKeyProperty(oServeRAIDInstance)
Call LogDebugString("Created the ServeRAID Device instance (Adaptec)", INFO_LEVEL)
Call oDiscoveryData.AddInstance(oServeRAIDInstance)
Exit For
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' call CreateNonLicensedServeRAID(1)
End If
Else
'Director Core Service 5.20.x and 6.2 (not 6.1.x) support Adaptec ServeRAID; and presuming the support will continue post 6.2.
If (IsRegExpMatched(agentVersion, "^6\.1")) Then
'Director 6.1.1 nor 6.1.2 do not support ServeRAID; but 6.2 does (and assuming post 6.2 does, too).
Call LogDebugString("Adaptec ServeRAID is not supported by Director 6.1.x", WARNING_LEVEL)
End If
iResult = GetWMIObjectCollection("root/adpt", "ADPT_ControllerProduct", oServeRAIDDeviceCollection)
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
'Got the ServeRAID Controller's instances
For Each oObjectItem in oServeRAIDDeviceCollection
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.ServeRAIDDevice.For.DirectorAgent.5.2x']$")
Call UpdateServeRAIDProperty(oServeRAIDInstance, oObjectItem, agentVersion)
Call BindHosterKeyProperty(oServeRAIDInstance)
Call LogDebugString("Created the ServeRAID Device instance (Adaptec)", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oServeRAIDInstance)
Exit For ' [d504104/byou: Need only one for all]
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' Call CreateNonLicensedServeRAID(2)
End If
End If
CreateTheAllServeRAIDDeviceInstance = 1
End Function
Function UpdateServeRAIDProperty(ByRef oServeRAIDInstance, ByVal oObjectItem, ByVal agentVersion)
Call LogDebugString("Entering UpdateServeRAIDProperty", INFO_LEVEL_FUNCTION)
Dim oElementName, oVendor
'[lin for 2.4, it's ok to use the predetermined value, while for per-instance support, we must not do like that.
'It also need to modify for Director 5.2 and subsequent, the oObjectItem.ElementName is not a key but should be IdentifyingNumber.
'We may need add more properties for RAID classes for user for readability.]
' [d504104/byou: Use the predetermined value, since we create one and only one such.]
oElementName = "ServeRAID-8x/7x/6x Controller(s) and Disk Drive(s)"
oVendor = "Adaptec, Inc."
' -- old code --
' oElementName = "Unknown"
' oVendor = "Unknown"
' ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
' If (IsRegExpMatched(agentVersion, "^5\.1")) Then
' 'Director Core Service 5.10.x
' oElementName = CStr(oObjectItem.Description)
' oVendor = CStr(oObjectItem.Manufacturer)
' Else
' 'For agent 5.20.x and 6.x (even though not supported with 6.1.1 nor 6.1.2)
' oElementName = CStr(oObjectItem.ElementName)
' oVendor = CStr(oObjectItem.Vendor)
' End If
' ON ERROR GOTO 0 ' Break on errors here on.
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",oElementName)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.ServeRAIDDevice']/Vendor$",oVendor)
End Function
Function CreateNonLicensedServeRAID(ByVal srType)
Dim oServeRAIDInstance
CreateNonLicensedServeRAID = -1
if srType = 1 Then
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.ServeRAIDDevice.For.DirectorAgent.5.1x']$")
elseif srType = 2 Then
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.ServeRAIDDevice.For.DirectorAgent.5.2x']$")
end if
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",SR_INSTANCE_NAME)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.ServeRAIDDevice']/Vendor$",NA)
Call LogDebugString("Create NonLicensed ServeRAID", INFO_LEVEL)
Call BindHosterKeyProperty(oServeRAIDInstance)
Call LogDebugString("Created a ServeRAID instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oServeRAIDInstance)
CreateNonLicensedServeRAID =1
End Function
'=========================== Create Instances for All LSI IntegratedRAID Device =========================
'Getting IntegratedRAID's instance in root/LSI_IR_1_2_0
If (IsRegExpMatched(agentVersion, "^5\.1")) Then
'Director Core Service 5.10.x, not support LSI IR Device
Call LogDebugString("LSI Integrated RAID is not supported by Director 5.10.x", INFO_LEVEL)
Else
If(IsRegExpMatched(agentVersion, "^5\.2")) Then
'Director Core Service 5.20.x
iResult = GetWMIObjectCollection(LSI_NAMESPACE, RAIDCARD_LSI_CLASS, oIntegratedRAIDDeviceCollection)
oNamespace = LSI_NAMESPACE
oIndicationClass = "CIM_AlertIndication"
Else
'Director Core Service 6.1.x
'LSIESG_IntegratedRaidChip.CreationClassName="LSIESG_IntegratedRaidChip",Tag="500605b00115f890"
'LSIESG_IntegratedRaidProduct.IdentifyingNumber="500605b00115f890",Name="SR-BR10i",Vendor="LSIESG",Version="Not Available"
iResult = GetWMIObjectCollection("root/LSI_MR_1_3_0", "LSIESG_IntegratedRaidProduct", oIntegratedRAIDDeviceCollection)
oNamespace = "root/LSI_MR_1_3_0"
oIndicationClass = "CIM_AlertIndication"
End If
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
'Got the IntegratedRAID Controller's instances
For Each oObjectItem in oIntegratedRAIDDeviceCollection
Set oIntegratedRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.LSI.IntegratedRAIDDevice']$")
Call UpdateIntegratedRAIDProperty(oIntegratedRAIDInstance, oObjectItem,oNamespace,oIndicationClass)
Call BindHosterKeyProperty(oIntegratedRAIDInstance)
Call LogDebugString("Created a IntegratedRAID Device instance", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oIntegratedRAIDInstance)
Exit For
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' Call CreateNonLicenseRAID( 1,oNamespace )
End If
End If
CreateTheAllIntegratedRAIDDeviceInstance = 1
End Function
ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oElementName = oObjectItem.ElementName
if(isNull(oObjectItem.ElementName)) then
'Director 6.1.x
'linlin modified at 2010/9/19, the IdentifyingNumber is a key. in Director 6.2.1
'We should use the Key property value to be the instanceID, since we deside to monitor per-instance.
'And there also need add a property name to this class.
'LSIESG_IntegratedRaidProduct.IdentifyingNumber="500605b00115f890",Name="SR-BR10i",Vendor="LSIESG",Version="Not Available"
'oElementName = oObjectItem.Name
oElementName = oObjectItem.IdentifyingNumber
end if
oElementName = CStr(oElementName)
Call LogDebugString("IntegratedRAID instanceID: " + oElementName , INFO_LEVEL)
oVendor = CStr(oObjectItem.Vendor)
ON ERROR GOTO 0 ' Break on errors here on.
Call oIntegratedRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",oElementName)
Call oIntegratedRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/Vendor$",oVendor)
Call oIntegratedRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/ibmNameSpace$",oNamespace)
'
End Function
'=========================== Create Instances for All LSI MegaRAID Device =========================
'Getting MegaRAID's instance in root/LSI_MR_1_2_0
If (IsRegExpMatched(agentVersion, "^5\.1")) Then
'Director Core Service 5.10.x, not support LSI MR Device
Call LogDebugString("Lenovo ServeRAID-MR is not supported by Director 5.10.x", INFO_LEVEL)
Else
If(IsRegExpMatched(agentVersion, "^5\.2")) Then
'Director Core Service 5.20.x
iResult = GetWMIObjectCollection(LSI_MR_NAMESPACE, LSI_MEGARAIDCARD_CLASS , oMegaRAIDDeviceCollection)
oNamespace = "root/LSI_MR_1_2_0"
oIndicationClass = "CIM_AlertIndication"
Else
'Director Core Service 6.1.x and later: LSIESG_MegaRAIDProduct
iResult = GetWMIObjectCollection("root/LSI_MR_1_3_0", LSI_MEGARAIDCARD_CLASS , oMegaRAIDDeviceCollection)
oNamespace = "root/LSI_MR_1_3_0"
oIndicationClass = "CIM_AlertIndication"
End If
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
'Got the MegaRAID Controller's instances
'Move out only create one instance even there are other MegaRAID Cards. While how about if there one MegaRAID 10m one 10i????
'linlin may have problem, need pay attention in other release
'only get the first one property
For Each oObjectItem in oMegaRAIDDeviceCollection
Set oMegaRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.LSI.MegaRAIDDevice']$")
Call UpdateMegaRAIDProperty(oMegaRAIDInstance, oObjectItem,oNamespace,oIndicationClass)
Call BindHosterKeyProperty(oMegaRAIDInstance)
Call LogDebugString("Created a MegaRAID Device instance", INFO_LEVEL)
Call oDiscoveryData.AddInstance(oMegaRAIDInstance)
'Exit For 'only get the first one property
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' Call CreateNonLicenseRAID( 2 ,oNamespace)
End If
End If
CreateTheAllMegaRAIDDeviceInstance = 1
End Function
Function UpdateMegaRAIDProperty(ByRef oMegaRAIDInstance, ByVal oObjectItem,ByVal oNamespace,ByVal oIndicationClass)
Call LogDebugString("Entering UpdateMegaRAIDProperty", INFO_LEVEL_FUNCTION)
Dim oElementName, oVendor
oElementName = "Unknown"
oVendor = "Unknown"
ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
'\\VAL-W2K3\root\lsi_mr_1_2_0:LSIESG_MegaRAIDProduct.IdentifyingNumber="5000087000580400",Name="LSIESG_MegaRAID_Product",Vendor="LSIESG",Version="2.23.0.32"
'oElementName =CStr(oObjectItem.ElementName)
oElementName = CStr(oObjectItem.IdentifyingNumber)
oVendor = CStr(oObjectItem.Vendor)
ON ERROR GOTO 0 ' Break on errors here on.
Call oMegaRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",oElementName)
Call oMegaRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/Vendor$",oVendor)
Call oMegaRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/ibmNameSpace$",oNamespace)
End Function
Function CreateNonLicenseRAID(ByVal rdtype,ByVal oNamespace)
Dim oServeRAIDInstance
Call LogDebugString("Entering CreateNonLicenseRAID", INFO_LEVEL_FUNCTION)
CreateNonLicenseRAID = -1
if rdtype = 1 Then
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.LSI.IntegratedRAIDDevice']$")
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",IR_INSTANCE_NAME)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/Vendor$",NA)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/ibmNameSpace$",oNamespace)
Call LogDebugString("Create NonLicensed IR", INFO_LEVEL)
elseif rdtype = 2 Then
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.LSI.MegaRAIDDevice']$")
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",MR_INSTANCE_NAME)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/Vendor$",NA)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/ibmNameSpace$",oNamespace)
Call LogDebugString("Create NonLicensed MR", INFO_LEVEL)
end if
Call BindHosterKeyProperty(oServeRAIDInstance)
Call oDiscoveryData.AddInstance(oServeRAIDInstance)
CreateNonLicenseRAID =1
End Function
'=========================== Create THE All Storage Device Instance =========================
Function CreateTheAllStorageDeviceInstance()
Call LogDebugString("Entering CreateTheAllStorageDeviceInstance", INFO_LEVEL_FUNCTION)
CreateTheAllStorageDeviceInstance = -1
Dim oStorageTargetInstance, oPropertyValue
Set oStorageTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.StorageDevice']$")
Call LogDebugString("Created a storage device instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oStorageTargetInstance)
CreateTheAllStorageDeviceInstance = 1
End Function
Function UpdateStorageProperty(ByRef oStorageInstance)
Call LogDebugString("Entering UpdateStorageProperty", INFO_LEVEL_FUNCTION)
Dim oPropertyValue
Call oStorageInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", "Non-Specific Disk Controller(s)/Drive(s)")
End Function
'===========================Create Instances for All Management Controllers =========================
Function CreateAllMgmtControllerInstances()
Call LogDebugString("Entering CreateAllMgmtControllerInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oMgmtControllerCollection, iResult
Dim oMgmtControllerInstance
CreateAllMgmtControllerInstances = -1
'Getting BMC's instance
iResult = GetWMIObjectCollection(CIMV2_NAMESPACE, COMPUTER_SYSTEM_CIMV2_CLASS, oMgmtControllerCollection)
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
For Each oObjectItem in oMgmtControllerCollection
' If (BMCPresented() > 0) Then
CreateBMC(oObjectItem)
' End If
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' Set oMgmtControllerInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.MgmtController']$")
' Call oMgmtControllerInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", IMM_INSTANCE_NAME)
' Call oMgmtControllerInstance.AddProperty("$MPElement[Name='IBM.SystemX.MgmtController']/FirmwareVersion$", NA)
' Call BindHosterKeyProperty(oMgmtControllerInstance)
' Call LogDebugString("Created a mgmt controller (BMC or IMM) instance; adding to discovery data", INFO_LEVEL)
' Call oDiscoveryData.AddInstance(oMgmtControllerInstance)
Else
Call LogDebugString("Can not get BMC collection instance", INFO_LEVEL)
End If
'Getting RSA's instance
If (RSAPresented() > 0) Then
CreateRSA()
End If
' iResult = GetWMIObjectCollection(CIMV2_NAMESPACE, PNPENTITY_CIMV2_CLASS, oManagementTargetCollection)
' If (iResult > 0) Then
' For Each oObjectItem in oManagementTargetCollection
' If (InStr(CStr(oObjectItem.DeviceID), BMC_ACPIINFO) <> 0) Then
' BMCPresented = 1
' Call LogDebugString("BMC Presented", INFO_LEVEL)
' Exit Function
' End If
' Next
' End If
' Call LogDebugString("BMC not Presented", INFO_LEVEL)
'End Function
Function CreateBMC(ByVal oObjectItem)
Call LogDebugString("Entering CreateBMC", INFO_LEVEL_FUNCTION)
CreateBMC = -1
Dim oMgmtControllerInstance, oHWSystemHostsMTargetRelation, oPropertyValue
Set oMgmtControllerInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.MgmtController']$")
Call LogDebugString("Created a mgmt controller (BMC or IMM) instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oMgmtControllerInstance)
CreateBMC = 1
End Function
Function UpdateIMMPropertyIfNotBMC( ByRef oMgmtControllerInstance)
Call LogDebugString("Entering UpdateIMMPropertyIfNotBMC", INFO_LEVEL_FUNCTION)
Dim iResult, oSWIDCollection, oObjectItem
iResult = GetWMIObjectCollection(IBMSE_NAMESPACE, IBMSD_SOFTWAREIDENTITY_CLASS, oSWIDCollection)
If (iResult > 0) Then
For Each oObjectItem in oSWIDCollection
If (IsIMMFirmware(oObjectItem)) Then
Call UpdateIMMProperty(oMgmtControllerInstance, oObjectItem)
End If
Next
End If
End Function
Function IsIMMFirmware( ByVal oObjectItem)
IsIMMFirmware = 0
Dim propName
propName = oObjectItem.Name
if not isnull(propName) then
if ( propName = "IMM" or propName = "IMM2") then
Call LogDebugString("IsIMMFirmware returns true", INFO_LEVEL)
IsIMMFirmware = 1
End if
End if
End Function
Function UpdateIMMProperty(ByRef oBMCInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdateIMMProperty", INFO_LEVEL_FUNCTION)
Dim sVersionString, oOEMStringItem, iBeginPos, iCurPos, iEndPos, oPropertyValue, FirmwareVersion
iEndPos = 0
'Get Firmware Version
sVersionString = oObjectItem.VersionString
Call LogDebugString("VersionString = " + sVersionString, INFO_LEVEL)
' If not isnull(sVersionString) then
' iCurPos = InStr(sVersionString, "[[")
' Call LogDebugString("left at " + iCurPos, INFO_LEVEL)
' If iCurPos <> 0 Then
' iCurPos = iCurPos + 1
' iEndPos = InStr(iCurPos, sVersionString, "]]")
' Call LogDebugString("right at " + iCurPos, INFO_LEVEL)
' FirmwareVersion = Mid(sVersionString, iCurPos, iEndPos-iCurPos)
' Else
' FirmwareVersion = sVersionString
' End If
' End If
Function CreateRSA()
Call LogDebugString("Entering CreateRSA", INFO_LEVEL_FUNCTION)
Dim oMgmtControllerInstance, oHWSystemHostsMTargetRelation, oPropertyValue
Set oMgmtControllerInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.MgmtController']$")
Call LogDebugString("Created a mgmt controller (RSA) instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oMgmtControllerInstance)
End Function
Function UpdateBMCProperty(ByRef oBMCInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdateBMCProperty", INFO_LEVEL_FUNCTION)
Dim oOEMStringArray, oOEMStringItem, iBeginPos, iCurPos, iEndPos, oPropertyValue, FirmwareVersion
iBeginPos = 0
iEndPos = 0
'Get Firmware Version
oOEMStringArray = oObjectItem.OEMStringArray
if not isnull(oOEMStringArray) then
For Each oOEMStringItem in oOEMStringArray
iBeginPos = Instr(oOEMStringItem, "IBM BaseBoard Management Controller")
If iBeginPos <> 0 Then
iBeginPos = iBeginPos + 1
iCurPos = Instr(iBeginPos, oOEMStringItem, "[")
If iCurPos <> 0 Then
iCurPos = iCurPos + 1
iEndPos = Instr(iCurPos, oOEMStringItem, "]")
FirmwareVersion = Mid(oOEMStringItem, iCurPos, iEndPos-iCurPos)
Exit For
End If
End If
Next
End if
If (not IsEmpty(FirmwareVersion)) and (not isnull(FirmwareVersion)) then
oPropertyValue = "BMC or IMM"
Call oBMCInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", oPropertyValue)
Call LogDebugString("FirmwareVersion not null, = "+FirmwareVersion, INFO_LEVEL_FUNCTION)
oPropertyValue = CStr(FirmwareVersion)
Call oBMCInstance.AddProperty("$MPElement[Name='IBM.SystemX.MgmtController']/FirmwareVersion$", oPropertyValue)
Call LogDebugString("UpdateBMCProperty finished.", INFO_LEVEL_FUNCTION)
End If
End Function
Function UpdateRSAProperty(ByRef oRSAInstance)