Lenovo HwBaseSystem - Provider di rilevamento

IBM.HwBaseSystem.DiscoveryProvider (DataSourceModuleType)

Lenovo HwBaseSystem - Provider di rilevamento

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource IBM.WinComputer.DiscoveryBase.Repository Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Lenovo HwBaseSystem - Secondi intervallo provider di rilevamento
TimeoutSecondsint$Config/TimeoutSeconds$Lenovo HwBaseSystem - Secondi timeout provider di rilevamento

Source Code:

<DataSourceModuleType ID="IBM.HwBaseSystem.DiscoveryProvider" Accessibility="Internal">
<Configuration>
<xsd:element name="IntervalSeconds" type="xsd:integer"/>
<xsd:element name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" ParameterType="int" Selector="$Config/IntervalSeconds$"/>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="IBM.WinComputer.DiscoveryBase.Repository">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime/>
<ScriptName>IBMHwBaseSystemDiscovery.vbs</ScriptName>
<Arguments>"$MPElement$" "$Target/Id$" "$Target/ManagementGroup/Name$" "$Target/Property[Type="IBM.SystemX.Platform"]/HostPrincipalName$" "$Target/Property[Type="IBM.SystemX.Platform"]/SystemUUID$" "$Target/Property[Type="IBM.SystemX.Platform"]/MTAndSN$" "$Target/Property[Type="IBM.SystemX.Platform"]/ModelNumber$" "$Target/Property[Type="IBM.SystemX.Platform"]/PlatformCategory$" "$Target/Property[Type="IBM.SystemX.Platform"]/ProductFamily$" "$Target/Property[Type="IBM.SystemX.Platform"]/HostPlatformAgentInfo$" $Target/Property[Type="System!System.Entity"]/DisplayName$</Arguments>
<ScriptBody><Script>

SetLocale("en-us")
Dim oArgs
Set oArgs = WScript.Arguments
WScript.Echo oArgs.Count
if oArgs.Count &lt; 11 Then
'Wscript.Quit -1
End If

Dim sourceID, managedEntityID, managementGroupName,targetComputerPrincipalName, systemUUID, mtAndsn, modelNumber, platformCategory, platformName, agentVersion, containHostID

sourceID = oArgs(0)
managedEntityID = oArgs(1)
managementGroupName = oArgs(2)
targetComputerPrincipalName = oArgs(3)
systemUUID = oArgs(4)
mtAndsn = oArgs(5)
modelNumber = oArgs(6)
platformCategory = oArgs(7)
platformName = oArgs(8)
agentVersion = oArgs(9)
containHostID = oArgs(10)

EventID = 104
Call BaseSystemDiscovery()

Sub BaseSystemDiscovery()

Dim oBag, iEndPos, searchChar

machineType = UNKNOWN

'Set oAPI = SCOMCreateObject("MOM.ScriptAPI")


Call LogDebugString("Entering BaseSystemDiscovery..." +vbCrlf+ _
" targetcomputer:'" + CStr(targetComputerPrincipalName) + "'" +vbCrlf+ _
" systemUUID:'" + CStr(systemUUID) + "'" +vbCrlf+ _
" mt-sn:'" + CStr(mtAndsn) + "'" +vbCrlf+ _
" model:'" + CStr(modelNumber) + "'" +vbCrlf+ _
" platformCat:'" + CStr(platformCategory) + "'", INFO_LEVEL_DETAIL)
searchChar = "-"
If (Len(mtAndsn) &gt; 4) Then
iEndPos = Instr(mtAndsn, searchChar)
If iEndPos &gt; 0 Then
machineType = Mid(mtAndsn, 1, iEndPos-1)
End If
End If

Set oDiscoveryData = oAPI.CreateDiscoveryData(0, sourceID, managedEntityID)

If (CreateBaseSystemInstances() &gt; 0) Then
Call LogDebugString("Created Platform", INFO_LEVEL)
End If

Call oAPI.Return(oDiscoveryData)

End Sub


Function CreateBaseSystemInstances()

Call LogDebugString("Entering CreateBaseSystemInstances", INFO_LEVEL_FUNCTION)
CreateBaseSystemInstances = 0

Dim oBaseSystemInstance
If IsDirAgentRunning() &gt; 0 Then
Set oBaseSystemInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.BaseSystem']$")

Call oBaseSystemInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputerPrincipalName)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.Platform']/HostPrincipalName$", CStr(targetComputerPrincipalName))

Call oBaseSystemInstance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", targetComputerPrincipalName + " (HW Node)")

Call UpdateBaseSystemProperty(oBaseSystemInstance)

Call oDiscoveryData.AddInstance(oBaseSystemInstance)
CreateBaseSystemInstances = 1
Call LogDebugString("CreateBaseSystemInstances successfully.", INFO_LEVEL)
End If
End Function


Function UpdateBaseSystemProperty(ByRef oBaseSystemInstance)

Call LogDebugString("Entering UpdateSystemProperty", INFO_LEVEL_FUNCTION)
Dim oPropertyValue

'Update SystemUUID
oPropertyValue = CStr(systemUUID)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/SystemUUID$", oPropertyValue)

'Update MTAndSN
oPropertyValue = CStr(mtAndsn)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/MTAndSN$", oPropertyValue)

'Update ModelNumber
oPropertyValue = CStr(modelNumber)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/ModelNumber$", oPropertyValue)

'Update HostPlatformCategory
oPropertyValue = CStr(platformCategory)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/HostPlatformCategory$", oPropertyValue)

'Update HostPlatformAgentInfo
oPropertyValue = CStr(agentVersion)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/HostPlatformAgentInfo$", oPropertyValue)

'Update HostSystemUUID
oPropertyValue = CStr(systemUUID)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/HostSystemUUID$", oPropertyValue)

'Update HostPrincipalName
oPropertyValue = CStr(targetComputerPrincipalName)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/HostPrincipalName$", oPropertyValue)

'Update FirmwareType
Call GetBIOSType(oPropertyValue)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/FirmwareType$", oPropertyValue)

'Update FirmwareVersion
Call GetFirmwareVersion(oPropertyValue)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/FirmwareVersion$", oPropertyValue)

'Update HyperthreadingEnabled
Call GetHyperthreadingStatus(oPropertyValue)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/HyperthreadingEnabled$", oPropertyValue)

'Update ProcessorSocketCapacity
Call GetProcessorSocketCapacity(oPropertyValue)
If InStr(oPropertyValue, "Unknown") &lt;&gt; 0 Then
oPropertyValue = "N/A"
Else
oPropertyValue = oPropertyValue + " Processor Socket(s)"
End If
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/ProcessorSocketCapacity$", oPropertyValue)

'Update MemorySlotCapacity
Call GetMemorySlotCapacity(oPropertyValue)
If InStr(oPropertyValue, "Unknown") &lt;&gt; 0 Then
oPropertyValue = "N/A"
Else
oPropertyValue = oPropertyValue + " DIMM(s)"
End If
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/MemorySlotCapacity$", oPropertyValue)

'Update ExpansionSlotCapacity
Call GetExpansionSlotCapacity(oPropertyValue)
If InStr(oPropertyValue, "Unknown") &lt;&gt; 0 Then
oPropertyValue = "N/A"
Else
oPropertyValue = oPropertyValue + " PCI/PCI-E/PCI-X(s)"
End If
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/ExpansionSlotCapacity$", oPropertyValue)

'Update PowerSupplyCapacity
Call GetPowerSupplyCapacity(oPropertyValue)
If InStr(oPropertyValue, "Unknown") &lt;&gt; 0 Then
oPropertyValue = "N/A"
Else
oPropertyValue = oPropertyValue + " Power Supply Module(s)"
End If
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/PowerSupplyCapacity$", oPropertyValue)

'Update ContainerHostD
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/ContainerHostID$", containHostID + " (" + CStr(platformCategory)+ ")")

'Update ContainerHostUUIID
oPropertyValue = CStr(systemUUID)
Call oBaseSystemInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/ContainerHostUUID$",oPropertyValue)

End Function

Function IsDirAgentRunning()
Call LogDebugString("Entering IsDirAgentRunning", INFO_LEVEL_FUNCTION)
IsDirAgentRunning = -1

Dim iResult, oSWCollection, swNamespace, swClass, oObjectItem, swServiceName, swName

swNamespace = CIMV2_NAMESPACE
swClass = SERVICE_CIMV2_CLASS
swServiceName = "wmicimserver"
swName = "IBM Director Platform Agent (Core Services, or Level-1 Agent)" ' [d504936/byou: changed]
'swName = "Director Core Services"

'Detect if Director Agent is running or not
iResult = GetWMIObjectCollection(swNamespace, swClass, oSWCollection)
If (iResult &gt; 0) Then
For Each oObjectItem in oSWCollection
If InStr(oObjectItem.Name, swServiceName) &lt;&gt; 0 Then
If Instr(oObjectItem.State, "Running") &lt;&gt; 0 Then
Call LogDebugString(swName + " is running!", INFO_LEVEL)
IsDirAgentRunning = 1
Exit For
End If
End If
Next
End If
If IsDirAgentRunning = -1 Then
Call LogDebugString(swName + " is not running!", INFO_LEVEL)
End If
End Function

Sub GetBIOSType(ByRef sBIOSType)

sBIOSType = UNKNOWN
Dim I
For I = 0 To UBound(HardwareCapacityTable)
If InStr(machineType, HardwareCapacityTable(I)(MACHINE_TYPE)) &lt;&gt; 0 Then
sBIOSType = HardwareCapacityTable(I)(BIOS_TYPE)
Exit Sub
End If
Next

End Sub

Sub GetProcessorSocketCapacity(ByRef sCapacityValue)
sCapacityValue = UNKNOWN
Dim I
For I = 0 To UBound(HardwareCapacityTable)
If InStr(machineType, HardwareCapacityTable(I)(MACHINE_TYPE)) &lt;&gt; 0 Then
sCapacityValue = HardwareCapacityTable(I)(PROCESSORSOCKET_MAX)
Exit Sub
End If
Next
End Sub

Sub GetMemorySlotCapacity(ByRef sCapacityValue)
sCapacityValue = UNKNOWN
Dim I
For I = 0 To UBound(HardwareCapacityTable)
If InStr(machineType, HardwareCapacityTable(I)(MACHINE_TYPE)) &lt;&gt; 0 Then
sCapacityValue = HardwareCapacityTable(I)(DIMMSLOT_MAX)
Exit Sub
End If
Next
End Sub

Sub GetExpansionSlotCapacity(ByRef sCapacityValue)
sCapacityValue = UNKNOWN
Dim I
For I = 0 To UBound(HardwareCapacityTable)
If InStr(machineType, HardwareCapacityTable(I)(MACHINE_TYPE)) &lt;&gt; 0 Then
sCapacityValue = HardwareCapacityTable(I)(EXPANSIONSLOT_MAX)
Exit Sub
End If
Next
End Sub

Sub GetPowerSupplyCapacity(ByRef sCapacityValue)
sCapacityValue = UNKNOWN
Dim I
For I = 0 To UBound(HardwareCapacityTable)
If InStr(machineType, HardwareCapacityTable(I)(MACHINE_TYPE)) &lt;&gt; 0 Then
sCapacityValue = HardwareCapacityTable(I)(POWERSUPPLY_MAX)
Exit Sub
End If
Next
End Sub

Sub GetFirmwareVersion(ByRef sFirmwareVersion)

Call LogDebugString("Entering GetFirmwareVersion", INFO_LEVEL_FUNCTION)
sFirmwareVersion = UNKNOWN
Dim iResult, oBIOSCollection, oObjectItem
' Use root/cimv2:Win32_BIOS.SMBIOSBIOSVersion instead of root/ibmsd:IBMPSG_BIOS.Version.
' Win32_BIOS.SMBIOSBIOSVersion is a more reliable source; see data collected at
' \\byou-gate54.kirkland.ibm.com\SCOM\MP_V2.3\logs\Defect504362\all_bios_detail.log
' Note the convention of the value: "-[" + BuildLevel + "-" + Version + "]-"
iResult = GetWMIObjectCollection(CIMV2_NAMESPACE, "Win32_BIOS", oBIOSCollection)
If (iResult &gt; 0) Then
Dim sRawVersion, iPosStart, iPosEnd, sTemp
For Each oObjectItem in oBIOSCollection
' OK to pass up as the raw value as is, since it is more complete for troubleshoot firmware problems.
sFirmwareVersion = oObjectItem.SMBIOSBIOSVersion
Call LogDebugString("Firmware verison: '" + sFirmwareVersion + "')", INFO_LEVEL)
' [Code to parse the version value according to the convention]...
' ' Parse the value of SMBIOSBIOSVersion, according to the convention.
' sRawVersion = oObjectItem.SMBIOSBIOSVersion
' iPosStart = InStr( sRawVersion, "-[" )
' iPosEnd = InStrRev( sRawVersion, "]-" )
' If (iPosStart &lt;&gt; 0) and (iPosEnd &lt;&gt; 0) and (iPosEnd &gt; (iPosStart+2)) Then
' sTemp = Mid( sRawVersion, iPosStart+2, iPosEnd-(iPosStart+2) )
' iPosStart = InStrRev( sTemp, "-" )
' If (iPosStart &lt;&gt; 0) and (Len(sTemp) &gt; iPosStart) Then
' sFirmwareVersion = Mid( sTemp, iPosStart+1, Len(sTemp)-iPosStart )
' Else
' sFirmwareVersion = sTemp
' End If
' Else
' sFirmwareVersion = sRawVersion
' End If
' Call LogDebugString("Firmware verison: '" + sFirmwareVersion + "' (raw value: '" + sRawVersion + "')", INFO_LEVEL)
Exit For ' we only need one instance
Next
Else
sFirmwareVersion = UNKNOWN
Call LogDebugString("Firmware version unknown (no instance in Win32_BIOS)!!", INFO_LEVEL)
End If
' [Code prior to 504362]...
' 'Const BIOSNAME = "System BIOS"
' Const BIOSNAME = "BIOS"
' 'Search for the Lenovo BIOS CIM Class
' iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, BIOS_IBMSD_CLASS, oBIOSCollection)
' If (iResult &gt; 0) Then
' For Each oObjectItem in oBIOSCollection
' If InStr(1,oObjectItem.Name, BIOSNAME, 1) &lt;&gt; 0 Then
' Call LogDebugString("BIOS Instance Presented", INFO_LEVEL)
' sFirmwareVersion = oObjectItem.Version
' Exit For
' End If
' Next
' Else
' Call LogDebugString("BIOS Instance not Presented", INFO_LEVEL)
' End If
End Sub


Sub GetHyperthreadingStatus(ByRef bEnabled)

bEnabled = "" ' ???

End Sub




</Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>