Advertisement
Advertisement
| 10.11.2008 at 10:05AM PDT, ID: 23806639 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: |
{code}
@echo off
set status=0
cd "C:\Program Files (x86)\MegaRAID Storage Manager"
MegaCli -? > nul
if not %errorlevel%==0 (
echo MegaRAID Storage Manager is not installed or not in path
exit 2
)
REM Check Vitual disk state
for /f "tokens=*" %%a in ('MegaCli -AdpAllInfo -a0 ^| find "Degraded"') do If "%%a" EQU "Degraded : 0" SET status=0
if %status%==0 (
echo Raid is OK>1.txt
exit 0
)
if %status%==1 (
echo Raid is DeGraded
exit 1
}
REM Check for Offline Virtual disks
for /f "tokens=*" %%a in ('MegaCli -AdpAllInfo -a0 ^| find "Offline"') do If "%%a" EQU "Offline : 0" SET status=0
if %status%==0 (
exit 0
)
if %status%==1 (
echo A drive went Offline
exit 1
)
REM Check for critical disk
for /f "tokens=*" %%a in ('MegaCli -AdpAllInfo -a0 ^| find "Critical Disks"') do If "%%a" EQU "Critical Disks : 0" SET status=0
if %status%==0 (
echo Raid is OK
exit 0
)
if %status%==1 (
echo A disk is Critical
exit 1
)
REM Check for failed disk
for /f "tokens=*" %%a in ('MegaCli -AdpAllInfo -a0 ^| find "Failed Disks"') do If "%%a" EQU "Failed Disks : 0" SET status=0
if %status%==0 (
echo Raid is OK
exit 0
)
if %status%==1 (
echo A disk has Failed
exit 1
REM Check for predictive failure of disk
)
for /f "tokens=*" %%a in ('MegaCli -AdpAllInfo -a0 ^| find "Predictive Filure Count"') do If "%%a" EQU "Predictive Failure Count: 0" SET status=0
if %status%==0 (
echo Raid is OK
exit 0
)
if %status%==1 (
echo Predictive Failure Count is Critical
exit 1
)
REM Check for media errors on disk
for /f "tokens=*" %%a in ('MegaCli -AdpAllInfo -a0 ^| find "Media Error Count"') do If "%%a" EQU "Media Error Count: 0" SET status=0
if %status%==0 (
echo Raid is OK
exit 0
)
if %status%==1 (
echo Media Error Count is Critical
exit 1
)
REM Check for other errors
for /f "tokens=*" %%a in ('MegaCli -AdpAllInfo -a0 ^| find "Other Error Count"') do If "%%a" EQU "Other Error Count: 0" SET status=0
if %status%==0 (
echo Raid is OK
exit 0
)
if %status%==1 (
echo Other Error Count is Critical
exit 1
)
REM Check for issues with raidcard firmware
for /f "tokens=*" %%a in ('MegaCli -AdpAllInfo -a0 ^| find "Firmware state"') do If "%%a" EQU "Firmware state: Online" SET status=0
if %status%==0 (
echo Raid is OK
exit 0
)
if %status%==1 (
echo Firmware state is Critical
exit 1
)
{code}
|