Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time

Status
Not open for further replies.

davy2k

Technical User
Mar 18, 2007
69
JP
Dear All,
I wrote the script below to gather Disk performance information on Windows 2003 server. (The aim is to create a graph with the csv file using perl script).

The script is working fine and got the result below:
Timestamp_PerfTime AvgDiskBytesPerTransfer AvgDiskQueueLength DiskTransfersPerSec
1.20739E+16 52087486464 4454334000 8224538

is it possible to use vbscript to get the Timestamp_PerfTime values in seconds for each row for the
AvgDiskBytesPerTransfer AvgDiskQueueLength DiskTransfersPerSec

rather than the exponential value of the Time stamp.

Also, please help with the definition of the Timestamp_PerfTime.

' Monitor Server Performance


strComputer = "."
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
'WScript.Echo "Computer Name: " & strComputerName

strFileOutput = "E:\PerfMon\PerfInfo7.csv"

' Create a Script Runtime FileSystemObject.
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Check to see if the output file exists. If so, open it for writing or appending.
' If not, create it and open it for writing.

If objFSO.FileExists(strFileOutput) Then
Set objOutputFile = objFSO.OpenTextFile (strFileOutput, FOR_WRITING)
Else
Set objOutputFile = objFSO.CreateTextFile(strFileOutput)
End If
If Err <> 0 Then
Wscript.Echo "Unable to open " & strFileOutput & " for output."
WScript.Quit
End If

'Create Disk Properties
objOutputFile.WriteLine "Computer Name: " & strComputerName
objOutputFile.WriteLine "Timestamp_PerfTime" & ", " & "AvgDiskBytesPerTransfer" & ", " & "AvgDiskQueueLength" & ", " & "DiskTransfersPerSec"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set objRefresher = CreateObject("WbemScripting.SWbemRefresher")
Set colItems = objRefresher.AddEnum _
(objWMIService, "Win32_PerfRawData_PerfDisk_PhysicalDisk").objectSet
objRefresher.Refresh

For i = 1 to 28900
For Each objItem in colItems
objOutputFile.WriteLine objItem.Timestamp_PerfTime & ", " & objItem.AvgDiskBytesPerTransfer & ", "& objItem.AvgDiskQueueLength & ", "& objItem.DiskTransfersPerSec

Wscript.Sleep 200
objRefresher.Refresh
Next
Next

Thank you in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top