====== Dell System Check ======
^ Author | [[ craig.boyce@rodney.govt.nz | Craig Boyce ]] |
^ Compatibility | Xymon 4.2 |
^ Requirements | Windows, BBWin, Dell Open Manage |
^ Download | None |
^ Last Update | 2007-08-06 |
===== Description =====
The script reports the status of the hardware on Dell Servers running Windows and Dell OpenManage 5.0 or greater and alerts upon any failure reported.
The information is gathered using the commandline interface omreport.
The script has successfully reported on power supply and disk failures but I have not had any other hardware failures.
===== Installation =====
=== Client side ===
- Copy the script to the bbwin\ext directory or any sub directory you would prefer.
- Update the bbwin\etc\bbwin.cfg externals section to include the script as per below making sure the path is correct.
The script allows the changing of the test column name and uptime duration before alerting by changing the following lines in the script.
| strTestName = "syscheck" | Change this to what you want the test column to be. |
| strUpTime = "30" | Change this to the length of time required before alerting a reboot is required. |
=== Server side ===
* None
===== Source =====
==== SystemCheck.vbs ====
'==========================================================================
' NAME: Server System check.vbs
' COMMENT: Report Information from Dell OpenManage
' AUTHOR: Craig Boyce, Rodney District Council
' EMAIL: craig.boyce@rodney.govt.nz
' HISTORY
' VERSION : 1.00 13/08/2006 Initial Development
' VERSION : 2.00 20/7/2007 Production Release
' VERSION : 2.10 1/8/2007 Updated by Sigurður Guðbrandsson (sigurdur@raforninn.is) to report detailed information for Physical Disk, Memory, NIC and Temp
' Now Requires OpenManage 5.2 to display the Physical disk information
' VERSION : 2.20 3/8/2007 Resolved issue with a non green status changing all the following statuses to the non green status
' VERSION : 2.30 7/8/2007 Added the ability to turn off individual status checks if not wanted.
' Requires Dell OpenManage 5.0 or greater to be installed on the Dell Servers
'==========================================================================
On Error Resume Next
Dim objShell,WSHNetwork
Dim typelib,cslid,ServerName,lastcntrlnum,cntrlnum,lastindexnum,indexnum,boolValid
Dim logmessage,logfile
Dim strLayout,strSize,strLine,intStart,strFail,strCmd
Dim shChassis,shStorageVirtual,shStoragePhysical,shMemory,shNetwork,shTemp
' Set Variables and get the Server Name
Set objShell = WScript.CreateObject("WScript.Shell")
Set WSHNetwork = WScript.CreateObject("WScript.Network")
ServerName = objShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
' User definable section
strTestName = "syscheck" ' Change this to what you want the test column to be.
shChassis = 1 ' Change this to 0 to disable the Chassis status check
shStorageVirtual = 1 ' Change this to 0 to disable the Storage Virtual status check
shStoragePhysical = 1 ' Change this to 0 to disable the Storage Physical status check
shMemory = 1 ' Change this to 0 to disable the Memory status check
shNetwork = 1 ' Change this to 0 to disable the Network status check
shTemp = 1 ' Change this to 0 to disable the Temperature status check
strAlarmState = "green"
strOutput = ""
cntrlnum = 0
indexnum = 0
Set oShell = WScript.CreateObject("WScript.Shell")
' Check to see If used with BBWin or Big Brother client and set extPath.
extPath = oShell.RegRead("HKLM\SOFTWARE\BBWin\tmpPath")
If extPath = "" Then
extPath = oShell.RegRead("HKLM\SOFTWARE\Quest Software\BigBrother\bbnt\ExternalPath\")
End If
' ========================================
' Main Code Starts Here
Set WinMgt = GetObject("winmgmts:")
Set CompSys = WinMgt.ExecQuery("Select * from Win32_ComputerSystem")
For Each Item In CompSys
strmake = rtrim(item.manufacturer)
strmodel = rtrim(item.model)
strram = Clng(Item.TotalPhysicalMemory /1048576) + 1
Next
Set CompSys = WinMgt.ExecQuery("Select * from Win32_Processor",,48)
For Each Item In CompSys
strproc = Item.Name
Next
Set CompSys = WinMgt.ExecQuery("Select * from Win32_BIOS")
For Each Item In CompSys
strSerial = rtrim(item.SerialNumber)
Next
strOutput = strOutput & "System Information for Server " & ServerName & vbcrlf & vbcrlf
strOutput = strOutput & strmake & vbtab & strmodel & vbtab & "Service Tag #" & vbtab & strSerial & vbcrlf & vbcrlf
strOutput = strOutput & "Processor:" & vbtab & strproc & vbcrlf
strOutput = strOutput & "Memory:" & vbtab & vbtab & strram & " Mb" & vbcrlf & vbcrlf
If Left(strmake, 4) = "Dell" Then
omapath = oShell.RegRead("HKLM\SOFTWARE\Dell Computer Corporation\OpenManage\Applications\SystemsManagement\InstallPath")
omaver = oShell.RegRead("HKLM\SOFTWARE\Dell Computer Corporation\OpenManage\Applications\SystemsManagement\Version")
omreportpath = omapath & "oma\bin\omreport"
strOutput = strOutput & "Dell OpenManage Web Page" & vbcrlf & vbcrlf
If shChassis = 1 Then
strOutput = strOutput & "Chassis Status Information" & vbcrlf & vbcrlf
strcommand = Chr(34) &omreportpath & Chr(34) & " chassis"
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Ok") Then
strOutput = strOutput & "&green" & vbtab & strLine & vbcrlf
End If
If InStr(strLine,"Non-Critical") Then
strAlarmState = "yellow"
strOutput = strOutput & "&yellow" & vbtab & strLine & vbcrlf
End If
If InStr(strLine,"Critical") Then
strAlarmState = "red"
strOutput = strOutput & "&red" & vbtab & strLine & vbcrlf
End If
Wend
End If
If shStorageVirtual = 1 Then
strOutput = strOutput & vbcrlf & "Storage Status Information for virtual disks" & vbcrlf & vbcrlf
' Determine the number of storage controllers in the server and loop through them displaying the virtual disk status
lastcntrlnum = DELLStorageCntrlNum()
While CInt(cntrlnum) <= CInt(lastcntrlnum)
strcommand = Chr(34) &omreportpath & Chr(34) & " storage vdisk controller=" & cntrlnum
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
DELLStorageStatus cntrlnum
cntrlnum = cntrlnum + 1
Wend
End If
If shStoragePhysical = 1 Then
strOutput = strOutput & vbcrlf & "Storage Status Information for physical disks" & vbcrlf & vbcrlf
' Determine the number of storage controllers in the server and loop through them displaying the physical disk status
' Time for a reset also on the ctrlnum used earlier.
cntrlnum = 0
lastcntrlnum = DELLStorageCntrlNum()
While CInt(cntrlnum) <= CInt(lastcntrlnum)
strcommand = Chr(34) &omreportpath & Chr(34) & " storage pdisk controller=" & cntrlnum
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
DELLStorageStatus cntrlnum
cntrlnum = cntrlnum + 1
Wend
End If
If shMemory = 1 Then
strOutput = strOutput & vbcrlf & "Memory Status Information for memory modules" & vbcrlf & vbcrlf
' Determine the number of memory indexes in the server and loop through them displaying the memory index status
strCmd = " chassis memory"
lastindexnum = DELLIndexNum
while CInt(indexnum) <= CInt(lastindexnum)
strcommand = Chr(34) &omreportpath & Chr(34) & " chassis memory index=" & indexnum
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
DELLMemoryStatus indexnum
indexnum = indexnum + 1
Wend
End If
indexnum = 0 ' Reset the indexnum variable
If shNetwork = 1 Then
strOutput = strOutput & vbcrlf & "Network Interface Status Information for NICS" & vbcrlf & vbcrlf
' Determine the number of nic indexes in the server and loop through them displaying the nic index status
strCmd = " chassis nics" ' We need to know what index we want
lastindexnum = DELLIndexNum
while CInt(indexnum) <= CInt(lastindexnum)
strcommand = Chr(34) &omreportpath & Chr(34) & " chassis nics index=" & indexnum
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
DELLNetworkStatus indexnum
indexnum = indexnum + 1
Wend
End If
indexnum = 0 ' Reset the indexnum variable
If shTemp = 1 Then
strOutput = strOutput & vbcrlf & "Temperature Status Information for Chassis" & vbcrlf & vbcrlf
' Determine the number of nic indexes in the server and loop through them displaying the nic index status
strCmd = " chassis temps"
lastindexnum = DELLIndexNum
while CInt(indexnum) <= CInt(lastindexnum)
strcommand = Chr(34) &omreportpath & Chr(34) & " chassis temps index=" & indexnum
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
DELLTemperatureStatus indexnum
indexnum = indexnum + 1
Wend
End If
End If
If strmake = "HP" Then
' For future development, If only HP had a command line interface for getting the server status
End If
' Write the file for BB
WriteFile extPath, strTestName, strAlarmState, strOutput
'===========================================================
' FUNCTIONS and SUBS start here
' This SUB is used for outputting the file to the external's directory in bb
SUB WriteFile(strExtPath, strTestName, strAlarmState, strOutput)
Set fso = CreateObject("Scripting.FileSystemObject")
strOutput = strAlarmState & " " & Date & " " & Time & vbcrlf & vbcrlf & strOutput & vbcrlf
Set f = fso.OpenTextFile(strExtPath & "\" & strTestName , 8 , TRUE)
f.Write strOutput
f.Close
Set fso = Nothing
END Sub
' This Function is used for determining the number of storage controllers in the server
' NEW: vdisk controllers should be the same amount as pdisk controllers (virtual == physical)
Function DELLStorageCntrlNum
strcommand = Chr(34) &omreportpath & Chr(34) & " storage vdisk controller=10" ' Check for 10 Controllers, The output lists the valid controllers in the server
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Invalid controller value. Read, controller=10") Then
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Valid values") Then
DELLStorageCntrlNum = Right(strLine, 1) ' Get the highest numbered controller
End If
Wend
End If
Wend
End Function
' This function is used for determining the number of indexes, this is almost identical to the storage function above
' TODO: I assume that there is only one memory array .. however I do not have a server with more arrays so this is defaulted to Array 1.
Function DELLIndexNum
strcommand = Chr(34) &omreportpath & Chr(34) & strCmd & " index=50" ' Check for 50 Indexes, The output lists the valid indexes in the server
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Error! Index too large.") Then
DELLIndexNum = Right(strLine, 1) ' Get the highest numbered index
End If
Wend
End Function
' This SUB is used for determining the status and information of the Dell Storage components
Sub DELLStorageStatus(strcntrl)
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"No Array/Hard Disks found") Then ' Check to see if there is a virtual disk on the controller
Exit Sub
End If
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Status") Then ' Check the status line of the output and get the status
intStart = InStr(strLine, ":")
intStart = intStart + 2
newLine = Mid(strLine, intStart, 250)
If newLine = "Ok" Then
strOutput = strOutput & "&green" & vbtab & newLine
End If
If newLine = "Non-Critical" Then
strAlarmState = "yellow"
strOutput = strOutput & "&yellow" & vbtab & newLine
End If
If newLine = "Critical" Then
strAlarmState = "red"
strOutput = strOutput & "&red" & vbtab & newLine
End If
End If
' ADDED: difference between physical and virtual includes added if statements.
' ADDED: predicted failure notice.
If Left(strLine, 4) = "Name" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strName = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & ": " & strName & " on Storage Controller " & strcntrl & vbcrlf
End If
If Left(strLine, 6) = "Layout" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strLayout = Mid(strLine, intStart, 250)
End If
If Left(strLine, 4) = "Size" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strSize = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & vbtab & " : " & strLayout & vbtab & strSize & vbcrlf & vbcrlf
End If
If Left(strLine, 7) = "Failure" Then
intStart = InStr(strLine, ":")
intstart = intStart + 2
strFail = Mid(strLine, intStart, 250)
End If
If Left(strLine, 4) = "Type" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strLayout = Mid(strLine, intStart, 250)
End If
If Left(strLine, 8) = "Capacity" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strSize = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & vbtab & " : " & strLayout & vbtab & strSize & vbcrlf
strOutput = strOutput & vbtab & vbtab & " : Failure Predicted = " & strFail & vbcrlf & vbcrlf
End If
Wend
Wend
End Sub
' This SUB is used for determining the status and information of the Dell Memory components
' The reason I read the next line after finding the line I want is that when I run omreport chassis memory index=NUM I get an attribute line and a value line.
Sub DELLMemoryStatus(strmemindex)
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Error! Index too large. Maximum memory index is:") Then ' Check to see if there is a memory module on this index.
Exit Sub
End If
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Status") Then ' Check the status line of the output and get the status
strLine = objStdOut.ReadLine
intStart = InStr(strLine, ":")
intStart = intStart + 2
newLine = Mid(strLine, intStart, 250)
If newLine = "Ok" Then
strOutput = strOutput & "&green" & vbtab & newLine
End If
If newLine = "Non-Critical" Then
strAlarmState = "yellow"
strOutput = strOutput & "&yellow" & vbtab & newLine
End If
If newLine = "Critical" Then
strAlarmState = "red"
strOutput = strOutput & "&red" & vbtab & newLine
End If
End If
' Let us display all the useful information now that we have the status.
If Right(strLine, 4) = "Name" Then
strLine = objStdOut.ReadLine
intStart = InStr(strLine, ":")
intStart = intStart + 2
strName = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & ": " & strName & " on Memory Index " & strmemindex & vbcrlf
End If
If Right(strLine, 4) = "Size" Then
strLine = objStdOut.ReadLine
intStart = InStr(strLine, ":")
intStart = intStart + 2
strSize = Mid(strLine, intStart, 250)
End If
If Right(strLine, 4) = "Type" Then
strLine = objStdOut.ReadLine
intStart = InStr(strLine, ":")
intStart = intStart + 2
strLayout = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & vbtab & " : " & strLayout & vbtab & strSize & vbcrlf
End If
If Right(strLine, 8) = "Failures" Then
strLine = objStdOut.ReadLine
intStart = InStr(strLine, ":")
intstart = intStart + 2
strFail = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & vbtab & " : Failures = " & strFail & vbcrlf & vbcrlf
End If
Wend
Wend
End Sub
' This SUB is used for determining the status and information of the Dell Network Interfaces
Sub DELLNetworkStatus(strnicindex)
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Error! Index too large.") Then ' Check to see if there is a memory module on this index.
Exit Sub
End If
boolValid = 0
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
' We cant get status information from NIC's
' If InStr(strLine,"Status") Then ' Check the status line of the output and get the status
' strLine = objStdOut.ReadLine
' intStart = InStr(strLine, ":")
' intStart = intStart + 2
' newLine = Mid(strLine, intStart, 250)
' If newLine = "OK" Then
' strOutput = strOutput & "&green" & vbtab & newLine
' End If
' If newLine = "Non-Critical" Then
' strAlarmState = "yellow"
' strOutput = strOutput & "&yellow" & vbtab & newLine
' End If
' If newLine = "Critical" Then
' strAlarmState = "red"
' strOutput = strOutput & "&red" & vbtab & newLine
' End If
'
' End If
' Let us display all the useful information we need
If Left(strLine, 9) = "Interface" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strName = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & ": " & strName & " on NIC Index " & strnicindex & vbcrlf
End If
If Left(strLine, 2) = "IP" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strSize = Mid(strLine, intStart, 250)
End If
If Left(strLine, 10) = "Connection" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strLayout = Mid(strLine, intStart, 250)
If Right(strLayout, 9) = "Connected" Then
boolValid = 1
End If
strOutput = strOutput & vbtab & vbtab & " : Connection Status: " & strLayout & vbcrlf
If boolvalid = 1 Then
strOutput = strOutput & vbtab & vbtab & " : IP Address: " & strSize & vbcrlf
End If
End If
Wend
Wend
strOutput = strOutput & vbcrlf
End Sub
' This SUB is used for determining the status and information of the Dell Chassis Temperatures
Sub DELLTemperatureStatus(strtempindex)
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Error! Index too large.") Then ' Check to see if there is a temperature sensor on this index.
Exit Sub
End If
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine,"Status") Then ' Check the status line of the output and get the status
intStart = InStr(strLine, ":")
intStart = intStart + 2
newLine = Mid(strLine, intStart, 250)
If newLine = "Ok" Then
strOutput = strOutput & "&green" & vbtab & newLine
End If
If newLine = "Non-Critical" Then
strAlarmState = "yellow"
strOutput = strOutput & "&yellow" & vbtab & newLine
End If
If newLine = "Critical" Then
strAlarmState = "red"
strOutput = strOutput & "&red" & vbtab & newLine
End If
End If
' Let us display all the useful information now that we have the status.
If Left(strLine, 5) = "Probe" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strName = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & ": " & strName & " on Chassis Index " & strtempindex & vbcrlf
End If
If Left(strLine, 7) = "Reading" Then
intStart = InStr(strLine, ":")
intStart = intStart + 2
strLayout = Mid(strLine, intStart, 250)
strOutput = strOutput & vbtab & vbtab & " : Temperature is " & strLayout & vbcrlf
End If
Wend
Wend
End Sub
\\
Download source: {{:monitors:systemcheck.zip}}
===== Screenshot =====
{{:monitors:syscheck.png?600}}
===== Known Bugs and Issues =====
* None
===== To Do =====
Please let me know of any issues with the script and I will attempt to resolve them.
===== Credits =====
The script is in part based upon a batch script called openmanage.cmd written by Dave Sobel (dave@evolvetech.com)
===== Changelog =====
* **2006-08-13**
* 1.00 - Initial Development
* **2007-07-20**
* 2.00 - Production Release
* **2007-08-01**
* 2.10 - Updated by Sigurður Guðbrandsson (sigurdur@raforninn.is) to report detailed information for Physical Disk, Memory, NIC and Temp
* Now Requires OpenManage 5.2 to display the Physical disk information
* **2007-08-03**
*2.20 - Resolved issue with a non green status changing all the following statuses to the non green status
* **2007-08-07**
* 2.30 - Added the ability to turn off individual status checks if not wanted.