What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How can I create a sensor to monitor the RAID status for HP or IBM servers running on Windows?

Votes:

0

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.

custom-exe custom-script-exe exe-script-sensor prtg raid script vbscript windows

Created on May 14, 2010 1:59:54 AM

Last change on Mar 19, 2015 3:41:30 PM by  Martina Wittmann [Paessler Support]



Best Answer

Accepted 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

  1. Copy the Software RAID Status Check script below.
  2. Open a text editor and paste the script into it.
  3. Save it as a VBScript file, for example, as SWRaid.vbs
  4. Place the file in the \Custom Sensors\EXE subfolder of your PRTG installation.
  5. Add an EXE/Script sensor to PRTG.
  6. In the add sensor dialog, select the created SWRaid script from the list in the EXE/Script section.
  7. 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

Created on Jun 4, 2010 2:46:44 AM



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.

Created on Jun 15, 2010 11:24:29 PM



Accepted 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

  1. Copy the Software RAID Status Check script below.
  2. Open a text editor and paste the script into it.
  3. Save it as a VBScript file, for example, as SWRaid.vbs
  4. Place the file in the \Custom Sensors\EXE subfolder of your PRTG installation.
  5. Add an EXE/Script sensor to PRTG.
  6. In the add sensor dialog, select the created SWRaid script from the list in the EXE/Script section.
  7. 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

Created on Jun 27, 2019 10:01:57 AM



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

Created on Jun 28, 2019 9:42:05 AM by  Sebastian Kniege [Paessler Support]



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

Created on Aug 17, 2019 7:10:33 AM



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

Created on Aug 19, 2019 11:39:29 AM by  Sebastian Kniege [Paessler Support]



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

Created on Aug 12, 2022 11:53:27 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.