asset moniitor

Web page embedded asset request monitor
New jmeter script: Latest updates

(updated 7/7/2015. See below for details.) Download project here

Put these extensions under jmeter/lib/ext: jmeter

Before downloading, please read our terms and conditions

We have a lot of 3rd party requests building our pages from adverts to font providers to monitoring tools etc. We suspect one of these components has been causing performance issues lately - we have noticed some slow responses in our regular monitoring tools. So we want to hone in on it and graph the trends.

The component in question is dynamic, built from javascript so we can�t simply call it with a regular monitoring solution. Instead we are going to use the webpagetest solution elswhere on this site and add in a monitor for this page component, digging into the detailed page of the webpagetest analysis to graph connection time, time to first byte and download time for this component:


I�ve added to the regular script to monitor one component but this could easily be extended if required, or you could run separate Jenkins jobs for each component you want to look for. And I�ve used the first uncached test run to get the data. probably best to just run one test run at a time for this monitoring purpose anyway. So the script now looks like this:


And the item processor is assuming certain patterns in the source code. This is working fine at the moment but may need keeping an eye on with future versions of webpagetest (as for everything on this site).

We are after this snippet of source code:

    <b>URL:</b> <a rel="nofollow" href="http://<request host>/cg/v5/?fv=dmn%3D<secret data>%3Bref%3D%3Burl%3Dhttp%253A%252F%252F<secret data>%252F%3Bscrw%3D1920%3Bscrh%3D1080%3Bclrd%3D24%3Bcok%3D1%3B&tst=0.598&jsver=5.13.1&ri=1&rul=">http://<request host>/cg/v5/?fv=dmn%3D<secret data>%3Bref%3D%3Burl%3Dhttp%253A%252F%252F<secret data>%252F%3Bscrw%3D1920%3Bscrh%3D1080%3Bclrd%3D24%3Bcok%3D1%3B&tst=0.598&jsver=5.13.1&ri=1&rul=</a><br>
    <b>Host:</b> <request host><br>
    <b>IP:</b> 23.xx.xx.xx<br>
    <b>Error/Status Code:</b> 200<br>
    <b>Client Port:</b> 39693<br>
    <b>Start Offset:</b> 0.814 s<br>
    <b>Initial Connection:</b> 31 ms<br>
    <b>Time to First Byte:</b> 66 ms<br>
    <b>Content Download:</b> 132 ms<br>
    <b>Bytes In (downloaded):</b> 10.3 KB<br>
    <b>Bytes Out (uploaded):</b> 0.4 KB<br>

Giving us the data we are after:


Usage notes

I�ve come to this script anew after quite a long time away from it. A few things to watch out for:

The script uses a csv file to specify the webpagetest scripts to send down. The actual webpagetest part of this has to be url encoded BUT the step name shouldn�t be as it will break the Jenkins graphs. e.g:

csv data input file:

    url_id,scriptDescription,script (this line is not included in the file)
    01,home page,navigate%20http%3A%2F%2Fwww.<mysite>.com

The fail limit is used to decide on pass/fail for the original (full) pages

The testHost and testHostPort refer to your installation of webpagetest - you could point at the public one I guess.

The utility port is used for the �delete chrome profile� element which I have greyed out. I think at some point this proved useful for me. It runs a php script on my local apache server to do some local file handling. The port is where that apache is listening.

The jenkins jmeter plugin graphs only work with integer values (hence the change from Kbytes to bytes for the download size graph (see the jmeter script code)

To graph the jtl files in jenkins use this pattern **/*.jtl (just a reminder)

The loop count for the �runTest� thread sets the limit on how many lines in the csv file we will process. I HAVE SET THIS TO ONE in the script available at the top of this page. Only one line of the csv file will be processed in this case, probably ok for a component monitor but you could certainly expand this out with some more coding perhaps.

I have introduced the �item_url� which is used in the �find_item� element to dig out the metrics from the webpagetest details page. So you can easily change the component you wish to monitor. See the code for details.

Update: In my own copy of this script I have added an extra if controller around the monitor so I can run without it when required - don�t want to have loads of different jmx files around if I don�t need them. So, the if controller has this condition:

    ${__javaScript("${item_url}".length > 10)}

and then I can send down a parameter such as -Jitem_url=not_in_use


UPDATE 7th July 2015
Changed some urls to get the summary page and raw results etc. Latest versions of webpagetest seem to be using php pages for these links. See the code for details.



[Home] [About (CV)] [Contact Us] [JMeter Cloud] [webPageTest] [_64 images] [asset moniitor] [Linux Monitor] [Splunk ETL] [Splunk API] [AWS bash] [LR Rules OK] [LR Slave] [LR CI Graphs] [LoadRunner CI] [LR CI Variables] [LR Bamboo] [LR Methods] [LR CI BASH] [Bash methods] [Jenkins V2] [Streaming vid] [How fast] [Finding Issues] [Reporting] [Hand over] [VB Scripts] [JMeter tips] [JMeter RAW] [Dynatrace] [Documents] [FAQ] [Legal]

In the Cartesian Elements Ltd group of companies