Administer > Manage application monitor templates and component monitors > Example tasks for application monitors > Monitor large directories using the Windows Script Monitor

Monitor large directories

You may need to log in with an administrator account to perform this action.

  1. On the Web Console, click Settings > All Settings > SAMSettings > Create a New Template.
  2. Name the template, click Add Component Monitor, then expand the Custom Component Monitors group, select Windows Script Monitor, then click Submit.
  3. Select credentials with appropriate permissions to run the script on the SolarWinds SAM server.
  4. Copy the following Visual Basic script to get the directory size into the Script Body field:

  5. Dim folderPath
    folderPath = WScript.Arguments(0)
    Set fs=WScript.CreateObject ("Scripting.FileSystemObject")
    Set folder= fs.GetFolder(folderPath)
    WScript.Echo "Message: Folder " &folderPath & " is " & folder.Size & " bytes large"
    WScript.Echo "Statistic: " & folder.Size
  1. Enter the UNC path name for the directory to monitor into the Script Arguments field.

Use the variable ${IP} for the IP address of the target node to which the monitor is assigned when the Windows Script monitor runs.

  1. Specify the critical and warning thresholds for the desired directory size, then click Submit.
  2. Create an assigned Application Monitor by assigning the Large Directory Monitor template to the node.
  1. On the Web Console, click Settings > All Settings > SAMSettings > Manually Assign Application Monitors.
  2. Select All in the Show only list, click Large Directory Monitor and then click Next.
  3. Click Manually Assign Application Monitors and Select All in the Show only list.
  4. Click Large Directory Monitor and then click Next.
  5. Locate and select the desired node and then click Next.
  6. Enter itadmin in the Credential Name field and then enter your credentials.
  7. Click Test, click Assign Application Monitors, and then click Done.

The Visual Basic code does the following:

  1. Reads the first argument passed to the UNC path name for the directory to monitor and stores it in FolderPath.

Creates the Scripting.FileSystemObject and stores it in fs.

  1. Retreives the folder name from the saved command line argument and stores it in folder.
  2. Displays the message with the folder name and the folder size.
  3. Displays the statistic (folder size in bytes).

The script does no error checking.