Could you please help me create a sensor to monitor RAID status on HP and IBM servers? For example, when one disk in RAID failed, an email will be sent to inform me about that.
How can I create a sensor to monitor the RAID status for HP or IBM servers running on Windows?
Votes:
0
Best Answer
Votes:
0
This article applies to PRTG Network Monitor 13.2 or later
Monitoring Windows Software RAID
It is possible to monitor a Windows Software RAID with PRTG. For this concern you need to create an EXE/Script Sensor which executes a corresponding VBScript.
The present article provides an approach for monitoring a RAID. The custom sensor as described here will be able to
- recognize if there is a Software RAID available (otherwise a No RAID available message will appear)
- monitor the status of a RAID: health of volume(s), failed volume(s), rebuilding volume(s).
The script is provided below. It is based on a script by Anchor: Monitoring Windows software RAID
Please refer to Serverfault for a general discussion about this topic: How do you monitor the health of a mirrored disk in Windows?
Prerequisites
Important notice: The PRTG probe which executes the script must run on the machine where the RAID is located.
Steps to Go
- Copy the Software RAID Status Check script below.
- Open a text editor and paste the script into it.
- Save it as a VBScript file, for example, as SWRaid.vbs
- Place the file in the \Custom Sensors\EXE subfolder of your PRTG installation.
- Add an EXE/Script sensor to PRTG.
- In the add sensor dialog, select the created SWRaid script from the list in the EXE/Script section.
- You can leave the other settings unchanged.
After saving the new sensor, PRTG will start to monitor the RAID immediately.
Script
See below for the SWRaid.vbs script:
' Software RAID status check script Option Explicit Dim WshShell, oExec Dim Line, RE0, RE1, RE2, RE3 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 Wscript.echo "0:WScript version < 5.6" WScript.Quit(2) End If Set WshShell = WScript.CreateObject("WScript.Shell") ' Execute the DISKPART program and grab the output Set oExec = WshShell.Exec("%comspec% /C echo list volume | %WINDIR%\SYSTEM32\DISKPART.EXE") ' Set up some regular expression objects Set RE0 = New RegExp Set RE1 = New RegExp Set RE2 = New RegExp Set RE3 = New RegExp RE0.Pattern = "Healthy" RE1.Pattern = "Mirror|RAID-5" RE2.Pattern = "Failed|(At Risk)" ' At Risk indicates errors have been reported for a disk ' and it may need to be reactivated. RE3.Pattern = "Rebuild" ' Check for no output If oExec.StdOut.AtEndOfStream Then Failed = 3 Else While Not oExec.StdOut.AtEndOfStream Line = oExec.StdOut.ReadLine ' Tests for Mirrored or RAID-5 volumes If RE1.Test(Line) Then ' Tests for Healthy volumes If RE0.Test(Line) Then If Failed = -1 Then Failed = 0 End If End If ' Tests for Failed RAID volumes If RE2.Test(Line) Then If Failed < 2 Then Failed = 2 ' Tests for Rebuilding volumes ElseIf RE3.Test(Line) Then If Failed < 0 Then Failed = 1 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.echo "0:All volumes Healthy" WScript.Quit(0) Case 1 WScript.echo "1:Volume(s) Rebuilding" WScript.Quit(1) Case 2 WScript.echo "2:Volume(s) have Failed" WScript.Quit(2) Case 3 WScript.echo "0:No Raid available" WScript.Quit(2) Case Else WScript.Quit(Failed) End Select
Created on Apr 17, 2013 2:03:11 PM by
Gerald Schoch [Paessler Support]
Last change on Apr 17, 2013 2:04:28 PM by
Gerald Schoch [Paessler Support]
8 Replies
Votes:
0
anyone out there managed this? i am also trying to do this.
thanks
Votes:
0
I would like to know also before i purchase this software. We take care of a lot of sites and I would like to know this answer.
Votes:
0
This article applies to PRTG Network Monitor 13.2 or later
Monitoring Windows Software RAID
It is possible to monitor a Windows Software RAID with PRTG. For this concern you need to create an EXE/Script Sensor which executes a corresponding VBScript.
The present article provides an approach for monitoring a RAID. The custom sensor as described here will be able to
- recognize if there is a Software RAID available (otherwise a No RAID available message will appear)
- monitor the status of a RAID: health of volume(s), failed volume(s), rebuilding volume(s).
The script is provided below. It is based on a script by Anchor: Monitoring Windows software RAID
Please refer to Serverfault for a general discussion about this topic: How do you monitor the health of a mirrored disk in Windows?
Prerequisites
Important notice: The PRTG probe which executes the script must run on the machine where the RAID is located.
Steps to Go
- Copy the Software RAID Status Check script below.
- Open a text editor and paste the script into it.
- Save it as a VBScript file, for example, as SWRaid.vbs
- Place the file in the \Custom Sensors\EXE subfolder of your PRTG installation.
- Add an EXE/Script sensor to PRTG.
- In the add sensor dialog, select the created SWRaid script from the list in the EXE/Script section.
- You can leave the other settings unchanged.
After saving the new sensor, PRTG will start to monitor the RAID immediately.
Script
See below for the SWRaid.vbs script:
' Software RAID status check script Option Explicit Dim WshShell, oExec Dim Line, RE0, RE1, RE2, RE3 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 Wscript.echo "0:WScript version < 5.6" WScript.Quit(2) End If Set WshShell = WScript.CreateObject("WScript.Shell") ' Execute the DISKPART program and grab the output Set oExec = WshShell.Exec("%comspec% /C echo list volume | %WINDIR%\SYSTEM32\DISKPART.EXE") ' Set up some regular expression objects Set RE0 = New RegExp Set RE1 = New RegExp Set RE2 = New RegExp Set RE3 = New RegExp RE0.Pattern = "Healthy" RE1.Pattern = "Mirror|RAID-5" RE2.Pattern = "Failed|(At Risk)" ' At Risk indicates errors have been reported for a disk ' and it may need to be reactivated. RE3.Pattern = "Rebuild" ' Check for no output If oExec.StdOut.AtEndOfStream Then Failed = 3 Else While Not oExec.StdOut.AtEndOfStream Line = oExec.StdOut.ReadLine ' Tests for Mirrored or RAID-5 volumes If RE1.Test(Line) Then ' Tests for Healthy volumes If RE0.Test(Line) Then If Failed = -1 Then Failed = 0 End If End If ' Tests for Failed RAID volumes If RE2.Test(Line) Then If Failed < 2 Then Failed = 2 ' Tests for Rebuilding volumes ElseIf RE3.Test(Line) Then If Failed < 0 Then Failed = 1 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.echo "0:All volumes Healthy" WScript.Quit(0) Case 1 WScript.echo "1:Volume(s) Rebuilding" WScript.Quit(1) Case 2 WScript.echo "2:Volume(s) have Failed" WScript.Quit(2) Case 3 WScript.echo "0:No Raid available" WScript.Quit(2) Case Else WScript.Quit(Failed) End Select
Created on Apr 17, 2013 2:03:11 PM by
Gerald Schoch [Paessler Support]
Last change on Apr 17, 2013 2:04:28 PM by
Gerald Schoch [Paessler Support]
Votes:
0
Pls show detail this Script because I followed this article but not success.
Best regards
Votes:
0
Hello Jimmy,
Thank you very much for your response.
Please elaborate your issue more in detail? What did you already do? What results do you see?
Best regards,
Sebastian
Votes:
0
Hi Sebastian
Sorry because feedback lately.
I also create a SWRaid.vbs and copy to installation PTRG folder.
In PRTG desktop, I add sensor... -> customs sensor -> EXE/Script -> I selected SWRaid.vbs in EXE?Scripts fields -> Save
But RAID sensor not appear, It's only show red warning ( System Error: No Raid available (code: PE022) ).
Pls help me fix this .
Best regards
Votes:
0
Hello Jimmy,
The script has to be run directly on the computer monitored. This is possible with a remote probe but before getting into this, please let me know what's the outcome when executing the .vbs file directly without PRTG's interaction.
Thank you very much in advance.
Sebastian
Votes:
0
Hi,
I tried it on Windows Server 2019 standard. the .vbs starts the diskpart.exe without an output. Perhaps Microsoft changed something with diskpart.exe, but this Sensor doesn't work for me at the moment.
Best Regards
Add comment