Dell Client Memory unit Status(Periodic)

Dell.WindowsClient.MemoryUnitUnitMonitor (UnitMonitor)

This Unit Monitor is disabled and not supported. Please do not enable it.

Knowledge Base article:

Summary

This Health Monitor is disabled and not supported. Please do not enable it.

Resolutions

This Health Monitor is disabled and not supported.

Element properties:

TargetDell.WindowsClient.MemoryUnit
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledFalse
Alert GenerateFalse
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Windows.TimedScript.ThreeStateMonitorType
RemotableTrue
AccessibilityInternal
RunAsDefault

Source Code:

<UnitMonitor ID="Dell.WindowsClient.MemoryUnitUnitMonitor" Accessibility="Internal" Enabled="false" Target="Dell.WindowsClient.MemoryUnit" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Windows!Microsoft.Windows.TimedScript.ThreeStateMonitorType" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<OperationalStates>
<OperationalState ID="Dell.WindowsClient.MemoryUnitSuccess" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Dell.WindowsClient.MemoryUnitWarning" MonitorTypeStateID="Warning" HealthState="Warning"/>
<OperationalState ID="Dell.WindowsClient.MemoryUnitFailure" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>3600</IntervalSeconds>
<SyncTime/>
<ScriptName>ExtendedClientMemoryUnit.vbs</ScriptName>
<Arguments>$Config/Computer$ $Target/Property[Type="Dell.WindowsClient.MemoryUnit"]/DeviceID$</Arguments>
<ScriptBody><Script>
'**********************************************************************************
' Script Name - Dell Client Discovery
' Author: Manoj Kumar Bora
'
' Description:
' Discover Dell Client and components for a Dell Client with OMCI / Dell Command | Monitor
'
' (c) Copyright Dell Inc. 2007-2012 All rights reserved
'**********************************************************************************

Option Explicit
On Error Resume Next
SetLocale("en-us")
Dim oArgs

'This UM is not supported. Hence, do not go ahead with rest of the script execution
Wscript.Quit -1

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

Dim strComputer, objDellConnection, objLogTextFile, objLogFSO, DebugScript, logMessage, sQuery, colItems, objItemMemory, targetComputer, prmDeviceID, logLevel
targetComputer = oArgs(0)

'formation of deviceID for physical memory instance "physical memory 0/1/n"
prmDeviceID = ""
Dim i
For i=1 to (oArgs.Count-1)
if (i = (oArgs.Count-1)) then ' this is to handle string "Physical Memory 0" where there are 2 spaces between "Memory" and "0"
prmDeviceID = prmDeviceID &amp; " " &amp; oArgs(i)
Else
prmDeviceID = prmDeviceID &amp; " " &amp; oArgs(i)
end if
Next

'In order to remove trailing and leading spaces
prmDeviceID = trim(prmDeviceID)

logLevel = 0
DebugScript = false
' Begin Logheader
If logLevel &lt;&gt; 0 Then
Dim fileSize, strOutFile
Const strFileName = "Monitor_DellWindowsClient_memoryStatus.log"
Const ForAppending = 8
Const ForWriting = 2
Const MaxFileSize = 524288 'File Size is limited to 512 KB

dim wsShell : Set wsShell = Createobject("WScript.Shell")
dim wshSysEnv : Set wshSysEnv = wsShell.Environment
dim tFolder : tFolder = wshSysEnv("TEMP")
dim wshPrcEnv : Set wshPrcEnv = wsShell.Environment("Process")
tFolder = Replace(tFolder, "%SystemRoot%", wshPrcEnv("SYSTEMROOT"), 1, -1, vbTextCompare)

Set objLogFSO = CreateObject("Scripting.FileSystemObject")
If Not objLogFSO.FolderExists(tFolder) Then
objLogFSO.CreateFolder(tFolder)
End If
strOutFile = tFolder &amp; "\"&amp; strFileName
If Not objLogFSO.FileExists(strOutFile) Then
Set objLogTextFile = objLogFSO.CreateTextFile(strOutFile)
objLogTextFile.Close()
End If
fileSize = objLogFSO.GetFile(strOutFile).Size
If (fileSize &gt; MaxFileSize) Then
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForWriting, True)
Else
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForAppending, True)
End If
logMessage = "INFO: Script - Dell Client memoryStatus Monitoring : Start() "
MOMDebugLog 1, logMessage
logMessage = " prmDeviceID " &amp; prmDeviceID &amp; " Arg 0 " &amp; oArgs(0) &amp; " Arg 1 " &amp; oArgs(1)
MOMDebugLog 1, logMessage
Err.Clear
End If

Sub MOMDebugLog (ByVal debugLevel, ByVal Message)
On Error Resume Next
DebugOut Message
If (debugLevel &gt; 0) and (debugLevel &lt;= logLevel) Then
objLogTextFile.WriteLine(Now() &amp; " ---- " &amp; Message)
Err.Clear
End If
End Sub
' End of Logheader
Class HealthComputer

Private m_fetcherObj
private m_pairObj
private m_memoryHealth

Public Default Function Init(pairs)
PairObj = pairs
Set Init = Me
End Function

private Function SanitizeValue(val)
LogMessage ="Val " &amp; val
MOMDebugLog 1, logMessage
SanitizeValue = val
'val = trim(val)
if ((val = "") or isNull(val) ) Then SanitizeValue = "Not Available"
End Function

public Property Get FetcherObj
FetcherObj = m_fetcherObj
End Property
Public Property Let FetcherObj(value)
m_fetcherObj = SanitizeValue(value)
End Property

public Property Get PairObj
PairObj = m_pairObj
End Property
Public Property Let PairObj(value)
m_pairObj = value
End Property

public Property Get MemoryHealth
Dim MemoryStatus
LogMessage ="ChassisHealth "
MOMDebugLog 1, logMessage
Dim fetcherObj
Set fetcherObj = New Fetcher
MemoryStatus = SanitizeValue(fetcherObj.GetHealthStatus(m_pairObj(0)))
If MemoryStatus = "3" OR MemoryStatus = "4" Then
logMessage = " Memory Warning"
MOMDebugLog 1, logMessage
MemoryHealth = "Warning"
ElseIf MemoryStatus = "5" OR MemoryStatus = "6" OR MemoryStatus = "7" Then
logMessage = " Memory Err"
MOMDebugLog 1, logMessage
MemoryHealth = "Error"
Else
logMessage = " Memory OK"
MOMDebugLog 1, logMessage
MemoryHealth = "OK"
End If
End Property
Public Property Let MemoryHealth(value)
m_memoryHealth = SanitizeValue(value)
End Property

End Class

Function LogErrorNumber(objName)
Dim logMessage
LogErrorNumber = Err.Number
If Err.Number &lt;&gt; 0 Then
Select Case Err.Number
Case -2147749904
logMessage = "CIM Object not found"
Case -2147749902
logMessage = "Dell CIM object not found"
Case -2147023169
logMessage = "RPC Failure occurred for namespace root-cimv2-dell"
Case -2147217389
logMessage = "Please Install/Re-Install ServerAdministrator on Dell Server!"
Case -2147217394 '0x8004100E
logMessage = "Not able to find Dell CIM object"
Case -2147217392 '0x8004100C
logMessage = "Not able to find the collection"
Case -2147749890
logMessage = "Object cannot be found"
Case -2147749892
logMessage = "Object cannot be found"
Case Else
logMessage = "Err: Unable to retrieve " &amp; objName &amp; vbCrLf &amp;_
" Error number: " &amp; Err.Number &amp; vbCrLf &amp;_
" Error description: '" &amp; Err.Description &amp; vbCrLf
End Select
MOMDebugLog 1, "ERROR: " &amp; logMessage

End If
End Function

' OMCI 7.x Creator

Class AttrNamePair
public WMIObjectName
public WMIObjectAttribute
public WMIServices
public index
End Class

Function CreateAttrNamePair(wmiService, wmiObject, wmiAttribute)
Set CreateAttrNamePair = New AttrNamePair
Set CreateAttrNamePair.WMIServices = wmiService
CreateAttrNamePair.WMIObjectName = wmiObject
CreateAttrNamePair.WMIObjectAttribute = wmiAttribute
End Function

Function CreateArrayAttrNamePair(wmiService, wmiObject, wmiAttribute, index)
Set CreateArrayAttrNamePair = New AttrNamePair
Set CreateArrayAttrNamePair.WMIServices = wmiService
CreateArrayAttrNamePair.WMIObjectName = wmiObject
CreateArrayAttrNamePair.WMIObjectAttribute = wmiAttribute
CreateArrayAttrNamePair.index = index
End Function

Class OMCI7x
private healthComputerObj, wbemServices, cmiV2WbemServices
private m_version
Public Default Function Init(version)
m_version = version
Set Init = Me
End Function

public Function getHealthComputer()

Dim strComputer : strComputer = "."
Err.Clear
Set wbemServices = GetObject("winmgmts:" &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\dellomci")
LogErrorNumber("root\dellomci")
logMessage = "getHealthComputer "
MOMDebugLog 1, logMessage
Dim pairs(1), i
i = -1
i = i + 1: Set pairs(i) = CreateAttrNamePair(wbemServices, "Dell_PhysicalMemory WHERE Tag = '" &amp; prmDeviceID &amp; "'", "Status")

If IsEmpty(wbemServices) Then
logMessage = "Unable to open WMI Namespace root-dellomci. Check to see if the WMI service is enabled and running, and ensure this WMI namespace exists."
MOMDebugLog 1, logMessage
Else
Set healthComputerObj = (new HealthComputer)(pairs)
Set getHealthComputer = healthComputerObj
End If
End Function
End Class

Class Fetcher
private m_healthComputerObj
Public Default Function Init( healthComputerObj)
m_healthComputerObj = healthComputerObj
Set Init = Me
End Function

Function GetAttribute(ByRef objItem, AttributeName)
If not objItem is nothing Then
Dim STR, arrayAttr
logMessage = "AttributeName " &amp; AttributeName
MOMDebugLog 1, logMessage
GetAttribute = objItem.Properties_.Item("" &amp; AttributeName)
If IsNull(GetAttribute) Then
logMessage = AttributeName &amp; " value is null"
MOMDebugLog 1, logMessage
ElseIf Len(GetAttribute) &lt;= 0 Then
logMessage = AttributeName &amp; " value is empty"
MOMDebugLog 1, logMessage
End If
logMessage = "Returning: " &amp; AttributeName &amp; " = " &amp; GetAttribute
MOMDebugLog 1, logMessage
'logMessage = "" &amp; AttributeName &amp; " " &amp; GetAttribute
End If
end function

public Function GetScalarAttribute(wbemServices, wmiobjectname, wmiattributename)
logMessage = "GetScalarAttribute Called"
MOMDebugLog 1, logMessage
On Error Resume Next
GetScalarAttribute = "Not Available"
Dim wbemObjectSet

Set wbemObjectSet = wbemServices.ExecQuery("Select * from " + wmiobjectname)
If (wbemObjectSet is Nothing) Or (isNull(wbemObjectSet)) Then
logMessage = "Unable to retrieve System Summary information"
MOMDebugLog 1, logMessage
Else
logMessage = "object retrieved successfully wmiobjectname " &amp; wmiobjectname
MOMDebugLog 1, logMessage
End if

On Error Resume Next
Err.Clear
Dim wbemObject
Dim val
For Each wbemObject in wbemObjectSet
logMessage = "C1"
MOMDebugLog 1, logMessage
If Err.Number &lt;&gt; 0 Then
logMessage = "Invalid Object found"
MOMDebugLog 1, logMessage
ElseIf not wbemObject is nothing Then

val = GetAttribute(wbemObject, wmiattributename)
GetScalarAttribute = val

logMessage = "::GetScalarAttribute = " &amp; GetScalarAttribute
MOMDebugLog 1, logMessage
End If
Next
End Function


Public Function GetHealthStatus(ByRef component)
logMessage ="GetHealthStatus fetched"
MOMDebugLog 1, logMessage
GetHealthStatus = GetScalarAttribute(component.WMIServices, component.WMIObjectName,component.WMIObjectAttribute)
End Function


End Class

' OMCI Factory
Class OMCIFactory
private m_omciObj
Private m_omciVersion

public Property Get OMCIVersion
OMCIVersion = m_omciVersion
End Property
Public Property Let OMCIVersion(value)
m_omciVersion = SanitizeValue(value)
End Property
Public Function ReadReg(RegPath)
On Error Resume Next

Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegRead(RegPath)

ReadReg = Key
End Function

Public Function GetOMCI

On Error Resume Next
logMessage = "Determining OMCI version ..."
MOMDebugLog 1, logMessage
Dim objItem, OMCIVersion, wbemServices, wbemObjectSet

Set wbemServices = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\dellomci")



If IsEmpty(wbemServices) Then 'If root-dellomci not present go for registery to fetch OMCI version
logmessage = "Unable to open WMI Namespace root-dellomci."
MOMDebugLog 1, logMessage
logmessage = "Reading Registery for OMCI version"
MOMDebugLog 1, logMessage

m_omciVersion = ReadReg("HKLM\Software\Dell Computer Corporation\OpenManage\Applications\Client\Version")
'Error checking

Else

Set wbemObjectSet = wbemServices.ExecQuery("Select * from Dell_SystemManagementSoftware")
If (wbemObjectSet is Nothing) Or (isNull(wbemObjectSet)) Then

logmessage = "Unable to retrieve System Summary information"
MOMDebugLog 1, logMessage
Else

For Each objItem in wbemObjectSet
'Error checking
If Err.Number &lt;&gt; 0 Then
logmessage = "Number:" &amp; Err.Number &amp; "Description:" &amp; Err.Description
MOMDebugLog 1, logMessage
End If
'Object Retrieval
If not objItem is nothing Then
m_omciVersion = objItem.Version
Else
logmessage = "Object is Nothing"
MOMDebugLog 1, logMessage

End If
Next
End If
End If
Set wbemServices = Nothing
if IsNull(m_omciObj) or (m_omciObj Is Nothing) Then
Dim b, versionNum
b = split(m_omciVersion, ".")
versionNum = b(0)
If (versionNum &gt; 7) Then
logMessage = "OMCIVersion is above 7: " &amp; m_omciVersion
MOMDebugLog 1, logMessage
Set m_omciObj = (New OMCI8x)(m_omciVersion)
ElseIf (versionNum = 7) Then
logMessage = "OMCIVersion is unmanaged: " &amp; m_omciVersion
MOMDebugLog 1, logMessage
Set m_omciObj = (New OMCI7x)(m_omciVersion)
Else
logMessage = "Err: Dell OMCI / Dell Command | Monitor Not Installed or its older version: Not Supported Client"
MOMDebugLog 1, logMessage
End If
Else
logMessage = "Reusing OMCI / Dell Command | Monitor object"
MOMDebugLog 1, logMessage
End If
Set GetOMCI = m_omciObj
End Function

Private Sub Class_Initialize
Set m_omciObj = Nothing
End Sub

End Class

' OMCI 8.x Creator
Class OMCI8x
private healthComputerObj, wbemServices, cmiV2WbemServices
private m_version
Public Default Function Init(version)
m_version = version
Set Init = Me
End Function

public Function getHealthComputer()

Dim strComputer : strComputer = "."
Err.Clear
Set wbemServices = GetObject("winmgmts:" &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\DCIM\SYSMAN")
LogErrorNumber("DCIM\SYSMAN")
logMessage = "getHealthComputer"
MOMDebugLog 1, logMessage
Dim pairs(1), i
i = -1
i = i + 1: Set pairs(i) = CreateAttrNamePair(wbemServices, "DCIM_PhysicalMemory WHERE Tag = '" &amp; prmDeviceID &amp; "'", "Status")

If IsEmpty(wbemServices) Then
logMessage = "Unable to open WMI Namespace root-DCIM-SYSMAN. Check to see if the WMI service is enabled and running, and ensure this WMI namespace exists."
MOMDebugLog 1, logMessage
Else
Set healthComputerObj = (new HealthComputer)(pairs)
Set getHealthComputer = healthComputerObj
End If
End Function
End Class

On Error Resume Next
Dim memoryStatus
Dim health

Dim omciObj, iomciFactory, Componenthealth
Set iomciFactory = New OMCIFactory
if not iomciFactory is Nothing then
logMessage = "iomci factory Object Created"
MOMDebugLog 1, logMessage
Set omciObj = iomciFactory.GetOMCI()
if not omciObj is Nothing then
logMessage = " Object Created"
MOMDebugLog 1, logMessage
set health = omciObj.getHealthComputer()
memoryStatus = health.MemoryHealth
logMessage = "&lt;&gt;memory Health :" &amp; memoryStatus
MOMDebugLog 1, logMessage
else
logMessage = " Object not created"
MOMDebugLog 1, logMessage
End if
else
logMessage = "iomci Object not created"
MOMDebugLog 1, logMessage

End if
On Error Goto 0
Dim oAPI, oBag
Set oAPI = CreateMOMScriptAPI()
set oBag = CreatePropertyBag (oAPI)
oInstAddValue oBag, "Status", memoryStatus
ReturnData oAPI, oBag

logMessage = "INFO : Script - Dell Client memoryStatus Monitoring : End()"
MOMDebugLog 1, logMessage
logMessage = "------------------------------------------------------"
MOMDebugLog 1, logMessage

' Close file used for logs
If logLevel &lt;&gt; 0 Then
logMessage = "Closing open file"
MOMDebugLog 1, logMessage
objLogTextFile.Close
Set objLogTextFile = Nothing
Set objLogFSO = Nothing
End If

'********** SCOM Functions
Function CreateMOMScriptAPI
If DebugScript = False Then
Set CreateMOMScriptAPI = CreateObject("MOM.ScriptAPI")
Else
Set CreateMOMScriptAPI = New RegExp
End If
logMessage = "INFO: New MOM.ScriptAPI"
MOMDebugLog 1, logMessage
End Function

Function CreatePropertyBag(ByRef oAPI)
If DebugScript = False Then
set CreatePropertyBag = oAPI.CreatePropertyBag()
Else
Set CreatePropertyBag = New RegExp
End If
logMessage = "INFO: New Monitor Data"
MOMDebugLog 1, logMessage
End Function

Sub ReturnData (ByRef oAPI, ByRef oBag)
If DebugScript = False Then
Call oAPI.Return(oBag)
End If
logMessage = "INFO: Returning Monitor Data"
MOMDebugLog 1, logMessage
End Sub

Sub oInstAddValue(ByRef oBag, prop, val)
If DebugScript = False Then
Call oBag.AddValue(prop, val)
End If
logMessage = "INFO: Set " &amp; prop &amp; " = " &amp; val
MOMDebugLog 1, logMessage
End Sub

Function CreateClassInstance(ByRef oDiscoveryData, ByRef classid)
If DebugScript = False Then
set CreateClassInstance = oDiscoveryData.CreateClassInstance(classid)
Else
Set CreateClassInstance = New RegExp
End If
logMessage = "INFO: New Class Instance" &amp; classid
MOMDebugLog 1, logMessage
End Function

Sub AddInstanceToDiscoveryData(ByRef oDiscoveryData, ByRef oInst)
If DebugScript = False Then
Call oDiscoveryData.AddInstance(oInst)
End If
logMessage = "INFO: AddInstance to Discovery Data"
MOMDebugLog 1, logMessage
End Sub

Function DebugOut(message)
If DebugScript Then WScript.Echo message

End Function


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