' LSI MYlex Fake RAID status check script: check_lsimylex_fakeraid.vbs ' Vincent Tamet ' ' v0.1 2010-08-05 ' ' !!! The script is for ONE volume only, if not you must finish it !!! ' Still wondering if rebuilding is warning level !? ' 'command[check_raid]=c:\Windows\system32\cscript.exe //NoLogo C:\nrpe\plugins2\check_lsimylex_fakeraid.vbs" ' ' ' ' Based on softraid http://www.anchor.com.au/hosting/dedicated/monitoring_windows_software_raid ' Bin: http://webdownload.ts.fujitsu.com/download/FileDownload/fileDownload.aspx?SoftwareGUID=45E07D66-7A5A-4550-BDA0-ECB42FA7EF33&FileFolder=Downloadfiles&FileTypeExtension=EXE&FileNameClient=FTS_LSIMYLEXSOFTWAREKITVERSION60232DRIVERSAN_60232_1004739.EXE&FileSize=399405&From=UVFwY19rRGdqY1JtQHBtYGhjcCIk ' ftp://ftp.supermicro.com/driver/SATA/LSI_Global_Array_Manager/ (S'ha de instal·lar això) ' Doc: I do the folowing test : HyperWin.exe /L ' LOG_DRIVE# : 0 ' START_SECTOR_NO : 00000000 ' SIZE_IN_MB : 76228 ' LDRV_STATE : Optimal ' RAID_LEVEL : RAID 1 ' ' LDRV_STATE : Degraded Option Explicit Dim WshShell, oExec Dim Line, RE0, RE1, RE2 Dim Failed Failed = -1 ' Simple variable to display status of all volumes: ' 0 = Healthy ' 1 = Rebuilding ' 2 = Failed ' 3 = Unknown ' Check version of WScript. Has to be >= 5.6 for WScript.Shell.Exec to work If Wscript.Version < 5.6 Then Failed = 3 Wscript.StdOut.WriteLine("UNKNOWN: WScript version < 5.6") WScript.Quit(Failed) End If Set WshShell = WScript.CreateObject("WScript.Shell") ' Execute the util program and grab the output Set oExec = WshShell.Exec("%comspec% /C echo;echo | %WINDIR%\SYSTEM32\HyperWin.exe /L") ' Set up some regular expression objects Set RE0 = New RegExp Set RE1 = New RegExp Set RE2 = New RegExp RE0.Pattern = "Optimal" RE1.Pattern = "LDRV_STATE" RE2.Pattern = "Failed|Degraded" ' Check for no output If oExec.StdOut.AtEndOfStream Then Failed = 3 Rebuild = 0 Else While Not oExec.StdOut.AtEndOfStream Line = oExec.StdOut.ReadLine 'Debug '''WScript.StdOut.WriteLine(Line) ' Tests for Raid volumes If RE1.Test(Line) Then ' Tests for Optimal volumes If RE0.Test(Line) Then If Failed = -1 Then Failed = 0 End If ' Tests for Failed RAID volumes If RE2.Test(Line) Then If Failed < 2 Then Failed = 2 End If End If WEnd End If ' If Failed is still -1, something bad has happened, or there is no RAID If Failed = -1 Then Failed = 3 ' Print out the appropriate test result Select Case Failed Case 0 WScript.StdOut.WriteLine("RAID OK: All volumes Optimal") Case 1 WScript.StdOut.WriteLine("RAID WARNING: Volume(s) Rebuilding") Case 2 WScript.StdOut.WriteLine("RAID CRITICAL: Volume(s) have Failed") Case 3 WScript.StdOut.WriteLine("RAID UNKNOWN: " + oExec.StdErr.ReadLine) End Select WScript.Quit(Failed)