This script will monitor file and directory size. It will generate performance data back to the management server. You can view this information under performance view in Operators Console or/and in reports. This first example will monitor the size C:\pagefile.sys
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("c:\pagefile.sys")
CreatePerfData "File","File Size",objFile.Path,objFile.SizeSub CreatePerfData(strObjectName,strCounterName,strInstanceName,numValue)
   Set objPerfData = ScriptContext.CreatePerfData
   objPerfData.ObjectName = strObjectName
   objPerfData.CounterName =strCounterName
   objPerfData.InstanceName = strInstanceName
   objPerfData.Value = numValue
   ScriptContext.Submit objPerfData
End Sub
This example will monitor the size of all subfolders under C:\Â
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\")
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders
CreatePerfData "File","File Size",objSubfolder.Path,objSubfolder.Size
Next
Sub CreatePerfData(strObjectName,strCounterName,strInstanceName,numValue)
                  Set objPerfData = ScriptContext.CreatePerfData
                  objPerfData.ObjectName = strObjectName
                  objPerfData.CounterName =strCounterName
                  objPerfData.InstanceName = strInstanceName
                  objPerfData.Value = numValue
                  ScriptContext.Submit objPerfData
End Sub
- Insert the script as a new script in Administrator Console
- Create a event rule that run the script every X minute
- Commit configuration change and wait until the script has run
- Open Operator Console, click performance, click you server and choose your new FILE performance objects, click draw graph
There is a guide about how to create performance data reports at momresources.org
[…] or on Linux machines. On Windows machines I use a two state monitor and a script, describe in this […]