Storage Controller Status(Event Triggered)

Dell.WindowsServer.StorageControllerEventUnitMonitor (UnitMonitor)

Unit Monitor to calculate Storage Controller Status on getting a related Event.

Knowledge Base article:

Summary

This Health Monitor fetches the State of Dell Storage Controller. The status can be one of the following three types:

Success: If the status is success, the Controller Component is in a normal state.

Warning: If the status is warning, the Controller Component is in a warning state.

Critical: If the status is critical, the Controller Component has failed.

Causes

Warning: The cause for a Warning status may be that one of the Storage Controllers on the Server is in a Warning State .

Critical: The cause for a Critical status may be that one of the Storage Controllers on the Server has failed . Additional details are available in the product knowledge of the last modified Dell OpenManage alert that caused the state change.

Resolutions

Perform the following steps for the Warning and Critical messages:

Warning: A Warning message refers to an event that is not necessarily significant, but may indicate a possible future problem. Plan to proactively replace the failed Storage Controller, based on the impact to operations, if the Storage Controller goes to a critical state.

Critical: A Critical message refers to a significant event that indicates actual or imminent loss of data or loss of function. Change the failed Storage Controller. Additional details are available in the product knowledge of the last modified Dell OpenManage alert that caused the state change.

When the issue has been resolved, the status changes to Success.

Element properties:

TargetDell.WindowsServer.StorageController
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateFalse
Alert Auto ResolveTrue
Monitor TypeDell.WindowsServer.EventTriggeredScriptMonitorType.3StateScriptMonitorType
RemotableTrue
AccessibilityPublic
RunAsDefault

Source Code:

<UnitMonitor ID="Dell.WindowsServer.StorageControllerEventUnitMonitor" Accessibility="Public" Target="Dell.WindowsServer.StorageController" TypeID="Dell.WindowsServer.EventTriggeredScriptMonitorType.3StateScriptMonitorType" ParentMonitorID="SystemHealth!System.Health.AvailabilityState">
<Category>AvailabilityHealth</Category>
<OperationalStates>
<OperationalState HealthState="Success" MonitorTypeStateID="Success" ID="HealthyState"/>
<OperationalState HealthState="Warning" MonitorTypeStateID="Warning" ID="WarningState"/>
<OperationalState HealthState="Error" MonitorTypeStateID="Critical" ID="CriticalState"/>
</OperationalStates>
<Configuration>
<ComputerName>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.LogicalDevice"]/DeviceID$</ComputerName>
<LogName>System</LogName>
<EventExpression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>GreaterEqual</Operator>
<ValueExpression>
<Value Type="Integer">2048</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>LessEqual</Operator>
<ValueExpression>
<Value Type="Integer">2900</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Server Administrator</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</EventExpression>
<ScriptName>DellStorageEventTrigger.vbs</ScriptName>
<Arguments>$Target/Property[Type="Dell.WindowsServer.StorageController"]/DeviceID$</Arguments>
<ScriptBody><Script>
'**********************************************************************************
' Script Name - DellStorageEventTrigger
' Author: Muralidhar
'
' Description:
' Determine Unit Monitor health for Dell Storage
'
' (c) Copyright &#xA9; 2009&#x2013; 2017 Dell Inc, or its subsidiaries. All Rights Reserved
'**********************************************************************************
Option Explicit
On Error Resume Next
SetLocale("en-us")

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

Dim prmDevice
prmDevice = oArgs(0)

Const WAIT_LOOP = 1000000
Const OM_REPORT_STORAGE_CONTR = "Storage"
Const DEF_OMSA_BIN_PATH = "C:\Program Files\Dell\OpenManage\oma\bin"
Const OMSA_REG_INTALL_PATH = "HKEY_LOCAL_MACHINE\SOFTWARE\Dell Computer Corporation\Dell OMA\InstallPath"
Const OMSA64_REG_INTALL_PATH = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Dell Computer Corporation\Dell OMA\InstallPath"

Dim StorageStatus, Storage, cAPI, oBag


Set Storage = New DellStorage
Storage.DiscoverStorageHealth()

Set cAPI = CreateObject("MOM.ScriptAPI")
Set oBag = cAPI.CreatePropertyBag()
Call oBag.AddValue("Status",StorageStatus)

Call cAPI.Return(oBag)

Set cAPI = Nothing
Set oBag = Nothing

Class DellStorage
Dim RegError, a, b, rc
Dim filespec, oShell, strCommand
Dim strRepFilePath, wintemp_path

Function DiscoverStorageHealth()
On Error Resume Next
Dim OMSABinPath, drive, version
RegError = 0

' Get OMSA Lib Path
rc = GetOMABinPath(OMSABinPath)
If rc &lt;&gt; 0 Then
WScript.Quit()
End If

' Get Install root path
rc = GetOMInstallRoot(drive, OMSABinPath) ' return the current absolute path or the root path for the OMSA Install
If rc &lt;&gt; 0 Then
WScript.Quit()
End If
If RegError = 1 Then
WScript.Quit()
End If

' Check VBScript engine version
version = CheckVBScriptEngine()
If version = True OR version = False Then
RunCLI drive, OMSABinPath
Else
WScript.Quit()
End If
End Function

'*****************************************************************
'Function RunCLI
'Routine For CLI VB.Run (For Version &lt; 5.6)
'*****************************************************************
Function RunCLI(ByVal targetDrive, ByVal strOMSABinPath)
On Error Resume Next
Dim guid1,guid3
GetTempFolderPath wintemp_path, targetDrive
GetOMReportFileGUID guid1
RunStorageCLI targetDrive, strOMSABinPath
End Function


'*****************************************************************
'GetOMABinPath
'Routine to read the registry to query the OMA Install Path
'*****************************************************************
Function GetOMABinPath(o_sPath)
On Error Resume Next
Dim strOMAKey
Dim oShell, tmp

Set oShell = CreateObject ("WScript.Shell")
o_sPath = ""
On Error Resume Next
o_sPath = oShell.RegRead(OMSA_REG_INTALL_PATH)
If o_sPath = "" Then
o_sPath = oShell.RegRead(OMSA64_REG_INTALL_PATH)
End If
If o_sPath = "" Then
tmp = DEF_OMSA_BIN_PATH &amp; "\omreport.exe"
If(bFileExists(tmp)) Then
o_sPath = DEF_OMSA_BIN_PATH
Else
RegError = 1
End If
Else
o_sPath = o_sPath &amp; "\bin"
End If
If Err &lt;&gt; 0 Then
GetOMSABinPath = Err.Number
Err.Clear
End If
End Function

'*****************************************************************
'GetOMInstallRoot
'Routine to determine the Drive letter where OMSA is installed
'*****************************************************************
Private Function GetOMInstallRoot(ByRef path, ByVal OMSAInstallPath)
On Error Resume Next
Err.Clear
' Return the root drive of the OMInstall Path
path = Left(OMSAInstallPath, 2)
End Function

'*****************************************************************
'bFileExists
'Routine to determine if the OMSA Report file is created
'*****************************************************************
Function bFileExists(filespec1)
On Error Resume Next
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
bFileExists = (fso.FileExists(filespec1))
Set fso = Nothing
End Function

'*****************************************************************
'DelFile
'Routine to delete the OMSA Report file
'*****************************************************************
Function DelFile(ByVal filespec2)
On Error Resume Next
Dim fso, oFile
If bFileExists(filespec2) Then
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile filespec2, True
Set fso = Nothing
End If
If Err &lt;&gt; 0 Then
DelFile = Err.Number
Err.Clear
End If
End Function

'**********************************************************
' CheckVBScriptEngine()
' Check VBScript engine version:
'**********************************************************
Function CheckVBScriptEngine()
On Error Resume Next
Dim bIsCompatV, var
Const VBSCRIPT_MIN_VERSION = 56
var = ((ScriptEngineMajorVersion * 10) + ScriptEngineMinorVersion)
If ((var) &lt; VBSCRIPT_MIN_VERSION) Then
bIsCompatV = False
Else
bIsCompatV = True
End If
If Err &lt;&gt; 0 Then
CheckVBScriptEngine = Err.Number
Err.Clear
Else
CheckVBScriptEngine = bIsCompatV
End If
End Function

'*****************************************************************
'Function RunStorageCLI - Called from RunCLI If StorageArrayManagerFlag = 0
'Routine For VB.Run (For Version &lt; 5.6)
'*****************************************************************
Function RunStorageCLI (ByVal Drive2, ByVal OMSABinPath)
On Error Resume Next
Dim guid22, timer
const TIMEOUT = 20
GetTempFolderPath wintemp_path, Drive2
GetOMReportFileGUID guid22
a = 1
b = 0
strRepFilePath = wintemp_path &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; guid22 &amp; ".xml"
strCommand = "cmd /C " &amp; chr(34) &amp; OMSABinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage controller -fmt xml -outc " &amp; strRepFilePath
filespec = strRepFilePath
Set oShell = CreateObject ("WScript.Shell")
rc = oShell.run (strCommand,0,true)
If rc &lt;&gt; 0 Then
Err.Clear
DelFile(strRepFilePath)
Else
timer = 0
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(filespec) &lt;&gt; -1
WScript.Sleep(1000)
timer = timer + 1
if (timer &gt; TIMEOUT) Then
Exit Do
End If
Loop

' Parse XML File
ParseStorageXML filespec

' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(strRepFilePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)

Set strRepFilePath = Nothing
Set strCommand = Nothing
Set oShell = Nothing
Set filespec = Nothing
End Function


'*****************************************************************
' Function ParseStorageXML
' Rollup GlobalStorageHealth from OMSS StorageController XML Output
'*****************************************************************
Function ParseStorageXML(ByVal storagefilepath)
On Error Resume Next
Dim contr_health, controller_arr, obj, obj_val
Dim xmlDoc, i

If(bFileExists(storagefilepath)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(storagefilepath)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
DelFile(storagefilepath)
Exit Function
End If

Set controller_arr = xmlDoc.getElementsByTagName("TreeStatus")
Set obj = xmlDoc.getElementsByTagName("GlobalNo")
contr_health = 0

For i = 0 To (controller_arr.length - 1)
contr_health = controller_arr.Item(i).nodeTypedValue
obj_val = obj.Item(i).nodeTypedValue

If StrComp(prmDevice,obj_val,1)=0 Then
If contr_health = 2 Then
StorageStatus = "OK"
ElseIf contr_health = 3 Then
StorageStatus = "Warning"
ElseIf contr_health = 4 Then
StorageStatus = "Error"
End If
End If
Next
End If
End If
End Function

'*****************************************************************
'GetTempFolderPath
'Routine to Get Win Temp Folder path
'*****************************************************************
Function GetTempFolderPath(ByRef WinTempFolder, ByVal drive_letter)
On Error Resume Next
Dim FldrExistFlag, fso
FldrExistFlag = False
dim wshShell : Set wshShell = Createobject("WScript.Shell")
dim wshSysEnv : Set wshSysEnv = wshShell.Environment
dim strSysTempFolder : strSysTempFolder = wshSysEnv("TEMP")
dim wshPrcEnv : Set wshPrcEnv = wshShell.Environment("Process")
strSysTempFolder = Replace(strSysTempFolder, "%SystemRoot%", wshPrcEnv("SYSTEMROOT"), 1, -1, vbTextCompare)
WinTempFolder = strSysTempFolder

Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(WinTempFolder)) Then
FldrExistFlag = True
Else
FldrExistFlag = False
End If

If WinTempFolder = "" OR FldrExistFlag = False Then
WinTempFolder = drive_letter
End If

Set wshShell = Nothing
Set wshSysEnv = Nothing
Set strSysTempFolder = Nothing
Set wshPrcEnv = Nothing

If Err &lt;&gt; 0 Then
GetTempFolderPath = Err.Number
Err.Clear
End If
End Function

'*****************************************************************
'GetOMReportFileGUID
'Routine to generate unique GUIDs for OMREPORT FILE
'*****************************************************************
Function GetOMReportFileGUID(ByRef o_guid)
On Error Resume Next
Dim TypeLib, NewGUID
Set TypeLib = CreateObject("Scriptlet.TypeLib")
NewGUID = TypeLib.Guid
o_guid = (left(NewGUID, len(NewGUID)-2))
Set TypeLib = Nothing
End Function

End Class
</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
<SuccessExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">OK</Value>
</ValueExpression>
</SimpleExpression>
</SuccessExpression>
<WarningExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Warning</Value>
</ValueExpression>
</SimpleExpression>
</WarningExpression>
<CriticalExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Error</Value>
</ValueExpression>
</SimpleExpression>
</CriticalExpression>
</Configuration>
</UnitMonitor>