cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 8

HOWTO: Monitor Drive Space of a Folder mount point?

Hi,

Do you have any solution for monitoring drivespace for a volume without a drive letter that is mounted as a folder? Eg D:\VOLUME1, D:\VOLUME2 etc etc.

It's an exchange cluster with about 64volumes on each server... I ran out of drive letters quite fast 🙂

3 Replies
Level 10

If you have APM, you can monitor the free space percentage on the Volume Mount Points via a Windows Script Monitor with a VBScript.  WE use this and it works great.  Below is the Monitor Description and the VBScript we use and the Script Arguments.  You will have to manually edit the WarningThreshold and CriticalThreshold variable values before running on the nodes.  As long as you know which nodes have Volume Mount Points, you would then assign this SAM Template to those nodes.  You also may want to set up an Advanced Alert.  :

Component Description:  This monitor is required only on nodes with Sub-Directory Mount Points.  We are using the out-of-the-box SolarWinds Volume Monitoring instead for regular root level drive monitoring (e.g. C:\).  Logical Disk Freespace check for Sub-Directory Mount Points (where the DriveLetter IS NULL).  If Statistic has a value of 2 then one or more Sub-Directory Mount Point drives are in Warning status and no Sub-Directory Mount nPoint drives in Critical Status (reports on all Sub-Directory Mount Point drives in Warning status).  If Statistic has a value of 3 then one or more Sub-Directory Mount Point  drives are in Critical status (reports on all Sub-Directory Mount Point drives in both Waring or Critical status).  Reports on all Logical Volumes in WMI Win32_Volume object where the DriveLetter IS NULL (designating it as a Sub-Directory Mount Point) AND the DriveType = 3 (Local Disk)

Script Arguments:  ${IP}

Script Engine:  vbscript

------------start VBScript----------------

'Option Explicit

On Error Resume Next

' Set Thesholds for this component

'Set Warning Threshold for all drives

Const WarningThreshold = 10

' Set Critical Threshold for all drives

Const CriticalThreshold = 5

' Required for WMI Query

Const wbemFlagReturnImmediately = &h10

Const wbemFlagForwardOnly = &h20

' Define Variables

Dim WshShell, objArgs, strIP, objWMIService, LogicalVolumes

Dim objItem, strDriveName, IntCapacity, IntFree, DiskFreePct

Dim strIgnoreFlag

Dim strMessage, IntStatistic

' Analyze Arguments (one argument is expected which is the IP Address of the Node to monitor

set objArgs = WScript.Arguments

If objArgs.Count > 0 Then

    strIP= objArgs(0)

End If

' Set the initial Statistic value to 0 which is all drives normal

IntStatistic = 0

' Set strIgnoreFlag = "No"

'

' If IntStatistic stays at 0 then all Sub-Directory Mount Point drives (DriveLetter IS NULL) are normal

'

' If IntStatistic has a value of 2 then one or more Sub-Directory Mount Point drives are in Warning status and no drives in Critical Status (reports on all drives in Warning status)

'

' If IntStatistic has a value of 3 then one or more Sub-Directory Mount Point drives are in Critical status (reports on all drives in both Waring or Critical status)

'Set the initial Message to blank

strMessage = ""

Set WshShell = CreateObject("WScript.Shell")

Set objWMIService = GetObject("winmgmts:\\" & strIP & "\root\CIMV2")

If Err <> 0 Then

  WScript.Echo "Message: Error Could not connect to  WMI root CIMV2 Namespace on IP " & strIP & ".  The Error Number was: " & Err.Number & ".  The Error Description was: " & Err.Description & "."

  Wscript.echo "Statistic: 1"

  Err.Clear

  Wscript.quit(1)

Else

  Set LogicalVolumes = objWMIService.ExecQuery("SELECT * FROM Win32_Volume where DriveType = '3' AND DriveLetter IS NULL", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

  If Err <> 0 Then

  WScript.Echo "Message: Error Could not connect to  WMI Win32_Volume on IP " & strIP & ".  The Error Number was: " & Err.Number & ".  The Error Description was: " & Err.Description & "."

  Wscript.echo "Statistic: 1"

  Err.Clear

  Wscript.quit(1)

  Else

  For Each objItem In LogicalVolumes

     If ( objItem.DriveType = 3 ) Then

  strDriveName = objItem.Name

'Checking Drivename for the patterns HarddiskVolume, LiveBackups, MAGLIB, and MagLib, and if found, skips to next drive in loop (zero means the pattern is not found)

  If strDriveName <> "" AND (InStr(1,strDriveName, "HarddiskVolume", 1) = 0) AND (InStr(1,strDriveName, "Livebackups", 1) = 0) AND (InStr(1,strDriveName, "MAGLIB", 1) = 0) AND (InStr(1,strDriveName, "MagLib", 1) = 0) Then

' strMessage = strMessage & " Logical Volume Name: " & strDriveName

  IntFree = objItem.FreeSpace

' strMessage = strMessage & "  Free Space: " & IntFree & " bytes"

  IntCapacity = objItem.Capacity

' strMessage = strMessage & "  Capacity: " & IntCapacity & " bytes"

  DiskFreePct = ((IntFree/IntCapacity)*100.00)

  DiskFreePct = Round(DiskFreePct, 2)

' strMessage = strMessage & "  Disk_Free_Pct: " & DiskFreePct

  If ( DiskFreePct <= WarningThreshold ) Then

'    strMessage = strMessage & "  WarningThreshold LOOP Entered."

     If DiskFreePct <= CriticalThreshold Then

' strMessage = strMessage & "  CriticalThreshold LOOP Entered."

  IntStatistic = 3

  strMessage = strMessage & "  ---  " & strDriveName & " Critical " & DiskFreePct & "% <=" & CriticalThreshold & "%."

     Else

  If IntStatistic <= 2 Then

  IntStatistic = 2

' strMessage = strMessage & "  Setting IntStatistic to 2.  Warning Threshold exceeded on " & strDriveName & "."

  strMessage = strMessage & "  --- " & strDriveName & " Warning " & DiskFreePct & "% <=" & WarningThreshold & "%."

  Else

' strMessage = strMessage & "  Warning Threshold exceeded on " & strDriveName & "."

  strMessage = strMessage & "  ---  " & strDriveName & " Warning " & DiskFreePct & "% <=" & WarningThreshold & "%."

  End If

     End If

  End If

         Else

  strIgnoreFlag = "Yes"

  strMessage = strMessage & "  LogicalDriveName: " & strDriveName & "  has been ignored due to either a blank Drive Name or due to one of the following patterns being in the Drive Name: HarddiskVolume LiveBackups MAGLIB MagLib."

         End If

     End If

  Next

  If IntStatistic = 0 Then

    If strIgnoreFlag = "Yes" Then

      strMessage = "The Disk Free Space for all Sub-Directory Mount Point drives is Normal." & strMessage

    Else

      strMessage = "The Disk Free Space for all Sub-Directory Mount Point drives is Normal."

    End If

  End If

  WScript.Echo "Message: " & Date & " " & Time & " " & strMessage & "  Statistic Value is: " & IntStatistic

  WScript.Echo "Statistic: " & IntStatistic

  WScript.Quit(IntStatistic)

  End If

End If

WScript.Quit(0)

------------end VBScript-----------------

0 Kudos
Level 13

When monitoring percentage of capacity, the Monitors we have are designed to look at drives or shares. With this type of linking, the OS is likely to give the incorrect drive statistics (off whatever physical volume D is).

We do have monitors that can scan the directory and alert on the amount of file space used, which can do the trick. You'll have to specify the value to alert in GB rather than "%-age". This might be acceptable depending on how many public folders & stores you have.

What do you think?

Edit/Note: If it is a beefy operation, you can elongate the polling interval for the Directory Monitor.

0 Kudos

I guess I could give it a try tomorrow. The best solution for us would probably be to try and get free space readings out of those volumes via snmp. Perhaps we can get this kind of info with snmp informant or similar.

0 Kudos