'=========================== Create Instances for All Power Supply =========================
Function CreateAllPowerSupplyInstances()
Call LogDebugString("Entering CreateAllPowerSupplyInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, colInstances, iResult
CreateAllPowerSupplyInstances = -1
'Getting Physical Memory's instance
iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, "IBMPSG_PowerSupply", colInstances)
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
For Each oObjectItem in colInstances
CreateOnePowerSupplyInstance(oObjectItem)
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' CreateNonLicensedPS()
Else
Call LogDebugString("Can not get PowerSupply collection instance", WARNING_LEVEL)
End If
CreateAllPowerSupplyInstances = 1
End Function
Function CreateNonLicensedPS()
Call LogDebugString("Entering CreateNonLicensedPS", INFO_LEVEL_FUNCTION)
CreateNonLicensedPS = -1
Dim oTargetInstance
Set oTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.PowerSupply']$")
Call LogDebugString("Created a NonLicensed PowerSupply instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oTargetInstance)
CreateNonLicensedPS = 1
End Function
Function CreateOnePowerSupplyInstance(ByVal oObjectItem)
Call LogDebugString("Entering CreateOnePowerSupplyInstance", INFO_LEVEL_FUNCTION)
CreateOnePowerSupplyInstance = -1
Dim oTargetInstance
Set oTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.PowerSupply']$")
'=========================== Create Instances for All Cooling Fan =========================
Function CreateAllCoolingFanInstances()
Call LogDebugString("Entering CreateAllCoolingFanInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, colInstances, iResult
CreateAllCoolingFanInstances = -1
'Getting Physical CoolingFan's instance (use IBMPSG_Fan for agent prior 6.1.x and later)
If(IsRegExpMatched(agentVersion, "^5\.")) Then
iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, "IBMPSG_Fan", colInstances)
Else
iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, "IBMPSG_Tachometer", colInstances)
End If
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
For Each oObjectItem in colInstances
CreateOneCoolingFanInstance(oObjectItem)
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' CreateNonLicensedFan()
Else
Call LogDebugString("Can not get CoolingFan collection instance", INFO_LEVEL)
End If
CreateAllCoolingFanInstances = 1
End Function
Function CreateNonLicensedFan()
Call LogDebugString("Entering CreateNonLicensedFan", INFO_LEVEL_FUNCTION)
CreateNonLicensedFan = -1
Dim oTargetInstance
Set oTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.CoolingFan']$")
Call LogDebugString("Created a CoolingFan instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oTargetInstance)
CreateOneCoolingFanInstance = 1
End Function
Function UpdateCoolingFanProperty(ByRef oTargetInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdateCoolingFanProperty", INFO_LEVEL_FUNCTION)
Dim oInstanceID, sSensorLocation
oInstanceID = "Unknown"
sSensorLocation = "Unknown"
ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oInstanceID = oObjectItem.DeviceID
sSensorLocation = CStr(oObjectItem.Description)
ON ERROR GOTO 0 ' Break on errors here on.
'=========================== Create Instances for All Temperature Sensor =========================
Function CreateAllTemperatureSensorInstances()
Call LogDebugString("Entering CreateAllTemperatureSensorInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, colInstances, iResult
CreateAllTemperatureSensorInstances = -1
'Getting Physical Memory's instance
iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, "IBMPSG_TemperatureSensor", colInstances)
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
For Each oObjectItem in colInstances
CreateOneTemperatureSensorInstance(oObjectItem)
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' CreateNonLicensedTemperature()
Else
Call LogDebugString("Can not get TemperatureSensor collection instance", INFO_LEVEL)
End If
CreateAllTemperatureSensorInstances = 1
End Function
Function CreateNonLicensedTemperature()
Call LogDebugString("Entering CreateNonLicensedTemperature", INFO_LEVEL_FUNCTION)
CreateNonLicensedTemperature = -1
Dim oTargetInstance
Set oTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.TemperatureSensor']$")
Call oTargetInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", TEMPERATURE_INSTANCE_NAME)
Call oTargetInstance.AddProperty("$MPElement[Name='IBM.SystemX.TemperatureSensor']/SensorLocation$", na)
Call BindHosterKeyProperty(oTargetInstance)
Call LogDebugString("Created a NonLicensed TemperatureSensor instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oTargetInstance)
CreateNonLicensedTemperature = 1
End Function
Function CreateOneTemperatureSensorInstance(ByVal oObjectItem)
Call LogDebugString("Entering CreateOneTemperatureSensorInstance", INFO_LEVEL_FUNCTION)
CreateOneTemperatureSensorInstance = -1
Dim oTargetInstance
Set oTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.TemperatureSensor']$")
Call LogDebugString("Created a TemperatureSensor instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oTargetInstance)
CreateOneTemperatureSensorInstance = 1
End Function
Function UpdateTemperatureSensorProperty(ByRef oTargetInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdateTemperatureSensorProperty", INFO_LEVEL_FUNCTION)
Dim oInstanceID, sSensorLocation
oInstanceID = "Unknown"
sSensorLocation = "Unknown"
ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oInstanceID = oObjectItem.DeviceID
sSensorLocation = CStr(oObjectItem.Description)
ON ERROR GOTO 0 ' Break on errors here on.
'=========================== Create Instances for All Voltage Sensor =========================
Function CreateAllVoltageSensorInstances()
Call LogDebugString("Entering CreateAllVoltageSensorInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, colInstances, iResult
CreateAllVoltageSensorInstances = -1
'Getting Physical Memory's instance
iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, "IBMPSG_VoltageSensor", colInstances)
'If (iResult > 0) and (hwLicense <> "None") Then
If (iResult > 0) Then
For Each oObjectItem in colInstances
CreateOneVoltageSensorInstance(oObjectItem)
Next
'ElseIf (iResult > 0) and (hwLicense = "None") Then
' CreateNonLicensedVoltage()
Else
Call LogDebugString("Can not get VoltageSensor collection instance", INFO_LEVEL)
End If
CreateAllVoltageSensorInstances = 1
End Function
Function CreateNonLicensedVoltage()
Call LogDebugString("Entering CreateNonLicensedVoltage", INFO_LEVEL_FUNCTION)
CreateNonLicensedVoltage = -1
Dim oTargetInstance
Set oTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.VoltageSensor']$")
Call LogDebugString("Created a VoltageSensor instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oTargetInstance)
CreateOneVoltageSensorInstance = 1
End Function
Function UpdateVoltageSensorProperty(ByRef oTargetInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdateVoltageSensorProperty", INFO_LEVEL_FUNCTION)
Dim oInstanceID, sSensorLocation
oInstanceID = "Unknown"
sSensorLocation = "Unknown"
ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oInstanceID = oObjectItem.DeviceID
sSensorLocation = CStr(oObjectItem.Description)
ON ERROR GOTO 0 ' Break on errors here on.
Call LogDebugString("Created an other device instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oDeviceInstance)
CreateAllOtherDeviceInstances = 1
End Function
Function UpdateOtherDeviceProperty(ByRef oOtherInstance)
Call LogDebugString("Entering UpdateOtherDeiveProperty", INFO_LEVEL_FUNCTION)
Call oOtherInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", "Other Devices")
End Function