Friday, December 30, 2005

I find myself needing to analyze Perfmon data frequently and its easier to import that data into SQL Server to do any serious crunching. To be fair, its pretty easy to get Perfmon to log directly to an ODBC data source, but there is always that odd time when you don't get the data that way.

Having a batch file allows you to script the import if you need to.

Save the following into a batch file for ease of use:

@REM Copy2SQL.bat
@REM %1 = .blg filename. e.g. TEST_00001.blg
@REM %2 = ODBC data source. e.g. PERFMON
@REM %3 = Test label. e.g "TEST1"

@SETLOCAL

@ECHO calling RELOG %1 -o SQL:%2!%3
@ECHO.
@RELOG %1 -o SQL:%2!%3

@ENDLOCAL


Call it from a command line like so:

c:\perfdata>Copy2SQL c:\perflogs\testdata_0001.blg PERFMON TEST1


You'll also need the relog.exe utility. Just drop it into your path for convience.

No comments:

Post a Comment