Documentation forServer & Application Monitor
Monitoring your applications and environment is a key capability of Hybrid Cloud Observability and is also available in a standalone module, Server & Application Monitor (SAM). Hybrid Cloud Observability and SAM are built on the self-hosted SolarWinds Platform.

Monitor large directories using the Windows Script Monitor

Before coding and testing your script, review Windows scripting details in the SAM Custom Application Monitor Template Guide and Best Practices for SAM templates.

  1. Click Settings > All Settings > SAM Settings > SAM Settings > Create a New Template.
  2. Name the template, click Add Component Monitor, select Windows Script Monitor, and click Add.
  3. Provide a brief Description.
  4. Select credentials with appropriate permissions to run the script on the target server.
  5. In the Script Arguments field, type the Universal Naming Convention (UNC) path name for the directory to monitor.

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

  6. Copy the following Visual Basic script, which retrieves the directory size, into the Script Body field:

    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

  7. Specify the critical and warning thresholds for the desired directory size, and then click Submit.
  8. Create an assigned Application Monitor by assigning the Large Directory Monitor template to the node.
    1. In the SolarWinds Platform Web Console, click Settings > All Settings > SAM Settings > 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.

When monitoring occurs, the Visual Basic code in the template will:

  1. Read the first argument passed to the UNC path name for the directory to monitor and store it in FolderPath.
  2. Create the Scripting.FileSystemObjectand store it in fs.
  3. Retrieve the folder name from the saved command line argument and store it in FolderPath.
  4. Display the folder name and folder size as output.
  5. Display the folder size, measured in bytes.

The script does not perform error checking.