Lenovo HwComponents HealthProvider Probe

IBM.HwComponents.HealthProvider.Probe (ProbeActionModuleType)

Element properties:

TypeProbeActionModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
PassThrough ProbeAction System.PassThroughProbe Default
Script ProbeAction IBM.WinComputer.PropertyBagBase.Repository Default

Source Code:

<ProbeActionModuleType ID="IBM.HwComponents.HealthProvider.Probe" Accessibility="Public" Batching="false" PassThrough="false">
<Configuration>
<xsd:element name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="PassThrough" TypeID="System!System.PassThroughProbe"/>
<ProbeAction ID="Script" TypeID="IBM.WinComputer.PropertyBagBase.Repository">
<ScriptName>IBMHwComponentsHealth.vbs</ScriptName>
<Arguments/>
<ScriptBody><Script>

SetLocale("en-us")

Dim oArgs
Set oArgs = WScript.Arguments
WScript.Echo oArgs.Count
if oArgs.Count &lt; 1 Then
'Wscript.Quit -1
End If

EventID = 111
Call GetComponentHealthStatus()


Sub GetComponentHealthStatus()

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

Call LogDebugString("Entering GetComponentHealthStatus", INFO_LEVEL_FUNCTION)
Set oBag= oAPI.CreatePropertyBag()
Call AddComponentHealthBag(oBag)
Call LogDebugString("Ending GetComponentHealthStatus", INFO_LEVEL_DETAIL)
Call oAPI.Return(oBag)'

End Sub

Function AddComponentHealthBag(ByRef oBag)
Call LogDebugString("Entering AddComponentHealthBag", INFO_LEVEL_FUNCTION)
Dim iResult, oCollection, oObjectItem, iComponentHealth, oDeviceID, oStorageHealth, oStorageHealthDes
AddComponentHealthBag = -1
iComponentHealth = -1
oStorageHealth = "Healthy"
oStorageHealthDes = ""

iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, COMPONENTHEALTH_IBMSD_CALSS, oCollection)
If (iResult &gt; 0) Then
'There is at least one instance of IBMPSG_ComponentHealth showed under the root/ibmsd namespace
For Each oObjectItem in oCollection
If IsStorageDevice(oObjectItem) Then
oDeviceID = STORAGEID
Else
If IsNull(oObjectItem.AlertingManagedElement) Then
oDeviceID = GetDeviceID(oObjectItem.EventID)
Else
oDeviceID = GetDeviceID(oObjectItem.AlertingManagedElement)
End If
End If
if oDeviceID&lt;&gt;"" then
'Got the relative instance in collection
If oObjectItem.PerceivedSeverity &gt;= 5 Then
'Error - Severity's value is 5+
Call LogDebugString(oDeviceID + " Error added into property bag", INFO_LEVEL)
If oDeviceID = STORAGEID Then
oStorageHealth = "Error"
oStorageHealthDes = oStorageHealthDes + oObjectItem.Description &amp; vbCrLf
Else
Call oBag.AddValue(oDeviceID, "Error")
Call oBag.AddValue(oDeviceID + "--Description", oObjectItem.Description)
End If
iComponentHealth = 1
ElseIf oObjectItem.PerceivedSeverity &gt;= 3 Then
'Warning - Severity's value is 3 or 4
Call LogDebugString(oDeviceID + " Warning added into property bag", INFO_LEVEL)
If oDeviceID = STORAGEID Then
If oStorageHealth &lt;&gt; "Error" Then
oStoragehealth = "Warning"
oStorageHealthDes = oStorageHealthDes + oObjectItem.Description &amp; vbCrLf
End If
Else
Call oBag.AddValue(oDeviceID, "Warning")
Call oBag.AddValue(oDeviceID + "--Description", oObjectItem.Description)
End If
iComponentHealth = 1
ElseIf oObjectItem.PerceivedSeverity &gt;= 1 Then
'Healthy - Severity's value is 1 or 2
' - no relative instances exist in the collection
'Dont need to set the health value for storage, just add the desciption
Call LogDebugString(oDeviceID + " Healthy added into property bag", INFO_LEVEL_DETAIL)
If oDeviceID = STORAGEID Then
oStorageHealthDes = oStorageHealthDes + oObjectItem.Description &amp; vbCrLf
Else
Call oBag.AddValue(oDeviceID, "Healthy")
Call oBag.AddValue(oDeviceID + "--Description", oObjectItem.Description)
End If
iComponentHealth = 1
End If
End If
Next
'Add value for storage device
Call oBag.AddValue(STORAGEID, oStorageHealth)
Call oBag.AddValue(STORAGEID + "--Description", oStorageHealthDes)
If iComponentHealth &lt; 0 Then
'Healthy - no relative instances exist in the collection, default value is Healthy
Call LogDebugString(" No instance in component health", WARNING_LEVEL)
iComponentHealth = 1
End If
Else
'No root/ibmsd namespace or instances of IBMPSG_ComponentHealth available
Call LogDebugString("Can not get Component Health instances", WARNING_LEVEL_DEV)
End If
End Function

'@\\KKR004\root\ibmsd:IBMPSG_PhysicalMemory.CreationClassName="IBMPSG_PhysicalMemory",Tag="Physical Memory 2f2801f4601f201f45"
'\\KKR004\root\ibmsd:IBMPSG_PowerSupply.CreationClassName="IBMPSG_PowerSupply",DeviceID="PS 1 Status:3f3201f201f450",SystemCreationClassName="IBMSD_ComputerSystem",SystemName="KKR004"
Function GetDeviceID(oEventID)
Dim iBeginPos, iEndPos, sTemp, searchChar
searchChar = DEVICEID1
iBeginPos = 0
iEndPos = 0
GetDeviceID = ""
iBeginPos = Instr(oEventID, searchChar)
If iBeginPos &lt;&gt; 0 Then
iBeginPos = iBeginPos + Len(searchChar)
searchChar = """"
iEndPos = Instr(iBeginPos, oEventID, searchChar)
If iEndPos &lt;&gt;0 Then
sTemp = Mid(oEventID, iBeginPos, iEndPos-iBeginPos)

sTemp = Replace(sTemp, "/", " ")
sTemp = Replace(sTemp, ".", " ")
GetDeviceID = LTrim(RTrim(sTemp))
End If
Else
searchChar = DEVICEID2
iBeginPos = Instr(oEventID, searchChar)

If iBeginPos &lt;&gt; 0 Then
iBeginPos = iBeginPos + Len(searchChar)
searchChar = """"
iEndPos = Instr(iBeginPos, oEventID, searchChar)
If iEndPos &lt;&gt;0 Then
sTemp = Mid(oEventID, iBeginPos, iEndPos-iBeginPos)
sTemp = Replace(sTemp, "/", " ")
sTemp = Replace(sTemp, ".", " ")
GetDeviceID = LTrim(RTrim(sTemp))
End If
Else
searchChar = DEVICEID3
iBeginPos = Instr(oEventID, searchChar)
If iBeginPos &lt;&gt; 0 Then
iBeginPos = iBeginPos + Len(searchChar)
searchChar = """"
iEndPos = Instr(iBeginPos, oEventID, searchChar)
If iEndPos &lt;&gt;0 Then
sTemp = Mid(oEventID, iBeginPos, iEndPos-iBeginPos)
sTemp = Replace(sTemp, "/", " ")
sTemp = Replace(sTemp, ".", " ")
GetDeviceID = LTrim(RTrim(sTemp))
End If
Else
searchChar = DEVICEID4
iBeginPos = Instr(oEventID, searchChar)

If iBeginPos &lt;&gt; 0 Then
iBeginPos = iBeginPos + Len(searchChar)
searchChar = """"
iEndPos = Instr(iBeginPos, oEventID, searchChar)
If iEndPos &lt;&gt;0 Then
sTemp = Mid(oEventID, iBeginPos, iEndPos-iBeginPos)
sTemp = Replace(sTemp, "/", " ")
sTemp = Replace(sTemp, ".", " ")
GetDeviceID = LTrim(RTrim(sTemp))
End If
End If
End If
End If
End If
End Function

Function IsStorageDevice(oObjectItem)

'find the key words for the storage device
'We have CIM_DiskDrive, IBMPSG_LogicalDisk, IBMPSG_DiskDrive now

IsStorageDevice = 0
Dim oIndicationString
oIndicationString = Null
oIndicationString = oObjectItem.AlertingManagedElement
If IsNull(oIndicationString) Then
oIndicationString = oObjectItem.EventID
End If
IsStorageDevice = IsStorageDeviceEx(oIndicationString)

End Function

Function IsStorageDeviceEx(oIndicationString)

'find the key words for the storage device
'We have CIM_DiskDrive, IBMPSG_LogicalDisk, IBMPSG_DiskDrive, ADPT_, IBMPSG_Storage, IBMPSG_ServeRAID now

IsStorageDeviceEx = 0
Dim iPos
iPos = Instr(oIndicationString, "CIM_DiskDrive")
If iPos &lt;&gt; 0 Then
IsStorageDeviceEx = 1
Exit Function
Else
iPos = Instr(oIndicationString, "IBMPSG_LogicalDisk")
End If

If iPos &lt;&gt; 0 Then
IsStorageDeviceEx = 1
Exit Function
Else
iPos = Instr(oIndicationString, "IBMPSG_DiskDrive")
End If

If iPos &lt;&gt; 0 Then
IsStorageDeviceEx = 1
Exit Function
Else
iPos = Instr(oIndicationString, "ADPT_")
End If

If iPos &lt;&gt; 0 Then
IsStorageDeviceEx = 1
Exit Function
Else
iPos = Instr(oIndicationString, "IBMPSG_Storage")
End If

If iPos &lt;&gt; 0 Then
IsStorageDeviceEx = 1
Exit Function
Else
iPos = Instr(oIndicationString, "IBMPSG_ServeRAID")
End If

If iPos &lt;&gt; 0 Then
IsStorageDeviceEx = 1
Exit Function
End If

End Function

</Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="Script">
<Node ID="PassThrough"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
<TriggerOnly>true</TriggerOnly>
</ProbeActionModuleType>