[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] 24x7 Script Archive


Collecting Web server performance statistics

// This script allows checking Web server response time.
// The number is saved in a file, which can be helpful
// in analyzing Web server performance such as estimating
// average response time and building busy rate graph as
// a dependency of time of day.

Dim current_time, time
Dim current_date, date
Dim start_time, datetime
Dim end_time, datetime
Dim duration, number
Dim file_number, number
Dim line, string

// Get start time
Today( current_date )
Now( current_time )
DateTime( current_date, current_time, start_time )

// Download index page from a Web server
// For example use popular Microsoft Web site
WebGetPageHTML( "http://home.microsoft.com/", "c:\temp\msweb.tmp" )

// Get end time
Today( current_date )
Now( current_time )
DateTime( current_date, current_time, end_time )

// Calculate response time
DateTimeDiff( start_time, end_time, duration )

// Build text line
Concat( "Start: ", start_time, line )
Concat( line, " End: ", line )
Concat( line, end_time, line )
Concat( line, " Duration: ", line )
Concat( line, duration, line )

// Append built line to the statistics file
FileOpen( "webstat.txt", "LineMode", "Write", TRUE, file_number )
FileWrite( file_number, line )
FileClose( file_number )

// Uncomment next line to open statistics file in Notepad
// Run( "notepad webstat.txt", "", file_number )