PowerShell script for analysis of Jmeter results

Working on a windows 2008 server this week and wanted to get a quick analysis of the Jmeter results at the end of the test before I go through the hassle of downloading a large file to my PC for analysis. On this companies corporate network believe me it is a hassle.

Anyway, I wondered whether Windows Power Shell could be used. I think LogParser would have been better but that would require going through configuration control to get this added to the Jmeter server I have been assigned. I have configured Jmeter to produce a .csv file and this comes out in the following form:

1363470556493,48,/,200,OK,06 BrowseSite 2-2,text,true,23632,6
1363470546578,49,0601HomePage,200,”Number of samples in transaction : 1, number of failing samples : 0″,06 BrowseSite 2-2,,true,23632,6

The transactions I am interested are wrapped in a transaction controller so we see the first line is a call to the page and the second line records the response time measured in the transaction controller.
For analysis I am interested in the first 3 columns the second (page/transaction) and third (response time). The test output is written to output.csv
From the PowerShell command prompt type the following:

import-csv output.csv -header "ts","resp","page" | select page,resp | sort page | group page | select Name, {($_.Group | Measure-Object -Average resp).Average}, {($_.Group | Measure-Object -Maximum resp).Maximum}, {($_.Group | Measure-Object -Sum resp).Count}

This will give you the average, maximum and count for each page and transaction controller in the test similar to below.

jmeter powershell

There are many improvements to be made such as reporting separately failed pages but thought I would share what I have done today. Thanks to Scott Hansel for a suitable similar example to use (http://www.hanselman.com/blog/ParsingCSVsAndPoorMansWebLogAnalysisWithPowerShell.aspx).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s