Using SteelApp Traffic Manager with SteelCentral Web Analyzer

Transcription

Using SteelApp Traffic Manager with SteelCentral Web Analyzer
DEPLOYMENT GUIDE
Using SteelApp Traffic Manager with
SteelCentral Web Analyzer
Riverbed Technical Marketing
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
Contents
Contents ................................................................................................................................................................................................................... 1 1.0 Solution Overview ............................................................................................................................................................................................. 2 1.1 End-User Experience Monitoring with Riverbed SteelApp Traffic ManagerTM and SteelCentral Web AnalyzerTM ............................... 2 1.2 Riverbed SteelApp™ Traffic Manager ......................................................................................................................................................... 3 1.3 SteelCentral Web AnalyzerTM........................................................................................................................................................................ 4 1.4 Advantages of using SteelApp with SteelCentral Web Analyzer .............................................................................................................. 5 2.0 Configuring SteelApp to inject a JavaScript snippet into your application ................................................................................................. 7 2.1 Create the JavaScript probe snippet for your application......................................................................................................................... 7 2.2 Create a simple TrafficScript rule in SteelApp............................................................................................................................................ 8 2.3 Building an advanced TrafficScript rule ...................................................................................................................................................... 9 2.4 Using the power of TrafficScript rules to decide when and how inject JavaScript .............................................................................. 10 2.4.1. Instrument only a specific range of pages ............................................................................................................................................ 10 2.4.2 Add additional metadata to track session-level information................................................................................................................ 11 2.4.3. Use SteelApp to support A/B testing and measurement ..................................................................................................................... 13 3.0 Programmable Infrastructure with Riverbed SteelScript ............................................................................................................................. 15 4.0 Conclusion ....................................................................................................................................................................................................... 15 Appendix A – A simple template rule................................................................................................................................................................... 16 A1. Create the new rule ..................................................................................................................................................................................... 16 A2. Copy in the encapsulated rule ................................................................................................................................................................... 16 A3. Customize the rule ...................................................................................................................................................................................... 17 Appendix B – How to find your clientId and appId parameters......................................................................................................................... 18 © 2014 Riverbed Technology. All rights reserved
1
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
1.0 Solution Overview
1.1 End-User Experience Monitoring with
Riverbed SteelApp Traffic ManagerTM and SteelCentral Web AnalyzerTM
Applications are the heart of any organization, helping the business to reach customers, build products, and automate business
processes. Increasing, those applications are web based. They may be hosted in the corporate data center, but they may also be
hosted in the cloud. Regardless, application performance drives business performance. Consequently it is critical to understand
how your web applications are actually performing, from the end user’s perspective. Whether users are local, half a world away, or
mobile, you must be able to monitor and troubleshoot their applications.
Riverbed’s Application Performance Management capabilities are a key component of the Riverbed Performance Management
platform, which provides the IT industry’s most comprehensive set of tools to monitor, analyze, and control application
performance for global enterprises.
Application Performance Management (APM) is now a key IT discipline because maintaining the performance and availability
of applications is the primary service an IT department provides to the enterprise. To enable this vital activity, Riverbed has been
delivering pioneering APM monitoring capabilities for more than ten years, and has emerged as a leading provider of solutions in
this rapidly growing market.
Riverbed SteelApp is the ideal tool to create dynamic instrumentation for your applications, without any modification to the
application itself, using SteelApp TrafficScript to create simple, yet powerful rules for content inspection and routing, and makes it
easy to gather transactions and statistics for analysis with SteelCentral Web Analyzer
© 2014 Riverbed Technology. All rights reserved
2
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
1.2 Riverbed SteelApp™ Traffic Manager
Despite increasing traffic loads, rapid change, and complex deployment infrastructures, online applications are still expected to
deliver consistently excellent service levels. SteelApp traffic management solutions provide complete control over user traffic,
allowing administrators to accelerate, optimize, and secure key business applications. Now it’s possible to deliver these services
more quickly and ensure the best possible performance across any deployment platform.
Application delivery controllers accelerate transactions, maximize availability, manage security policies, and provide a point of
control to monitor and manage application traffic. SteelApp Traffic Manager is a software-based ADC that provides unprecedented
scale and flexibility to deliver applications across the widest range of environments, from physical and virtual data centers to public
and hybrid clouds.
SteelApp Traffic Manager Benefits include:
•
Speed: Accelerate services, increase capacity, and reduce costs by offloading performance-draining tasks such as SSL and
compression onto SteelApp Traffic Manager’s optimized implementations. Cache commonly requested content and optimize
traffic delivery to applications so they’ll run as fast as they would in a perfect benchmark environment.
•
Reliability: Improve application availability by intelligently distributing traffic, avoiding failed or degraded servers, monitoring
performance problems, and shaping traffic spikes.
•
Improved security: SteelApp Traffic Manager operates as a deny-all gateway, only admitting traffic types it has been
configured to admit. This provides full control over how traffic is internally routed. High-performance inspection can
interrogate any part of a request or response to apply global filtering or scrubbing policies. The SteelApp Application Firewall
option also protects against a broad range of web application attacks.
•
Ease of management: SteelApp Traffic Manager makes it easy to manage how users interact with applications and the
infrastructure those applications depend on. Use it to shape, prioritize, and route traffic, to drain infrastructure resources prior
to maintenance, and to upgrade user sessions across application instances, all while preserving the user experience that
business demands.
© 2014 Riverbed Technology. All rights reserved
3
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
1.3 SteelCentral Web AnalyzerTM
SteelCentral Web Analyzer is a truly unique solution in the EUE space, offering not only end-user experience information at the
transaction level, but also troubleshooting workflows to determine the contributors to application delay. SteelCentral Web Analyzer
is available as an enterprise software solution, as well as Software-as-a-Service,
SteelCentral Web Analyzer leverages lightweight, simple JavaScript instrumentation to monitor the true end user experience for
web-based applications. It pinpoints the contributing sources of delay end-to-end, to eliminate finger pointing and accelerate
troubleshooting. Customizable dashboards provide detailed reporting of performance, response time, geography, platform type,
page view statistics, and Apdex (an industry standard for measuring user satisfaction). SteelCentral Web Analyzer measures
every single web transaction — not just samples — enabling historical and near real-time forensic analysis of performance
problems.
Analyze every transaction,
highlighting SLA violations
Review application response time
distribution by geographic location
SteelCentral Web Analyzer extends end-user experience monitoring to all web applications and web browser users wherever they
are located, including mobile users and applications running in the cloud. It is available as a SaaS offering from Riverbed, or as
software for on-premise deployment.
© 2014 Riverbed Technology. All rights reserved
4
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
1.4 Advantages of using SteelApp with SteelCentral Web Analyzer
SteelCentral Web Analyzer SaaS Edition requires a JavaScript snippet to instrument web pages downloaded by browsers,
extending end-user experience monitoring to all users, and Riverbed SteelApp is the ideal tool to create dynamic instrumentation
for your applications, without any modification to the application itself.
SteelApp has a powerful application-level tool for creating powerful rules for content inspection and routing: SteelApp TrafficScript
can create simple, yet powerful rules to embed the JavaScript fragment in every page, regardless of how the page was generated
or where the content was stored. There are number of advantages of using SteelApp to inject the JavaScript into your application:
•
•
•
•
•
No modification needed to the application
SteelApp makes it easy to select which pages you want to instrument
SteelApp can be used to instrument applications both in your data center, and in the cloud
SteelApp is able to insert JavaScript into compressed HTML pages (eg, gzip encoded)
A powerful scripting language allows for the injection of dynamic JavaScript snippets for deeper analysis
Metrics collated, analyzed, and
shared centrally via browser
<html><body>
...document content
...no changes to the app
</body></html>
Rules JavaScript snippet inserted automatically
<script>
var OPNET_ARXS={startJS:Number(new Date()),
clientId:"ABCD1234EFGH5678",appId:123456}};
(function(){
...........
})();
</script>
This diagram shows how SteelApp Traffic Manager sits in front of the web application on the right, and is able to analyze and
inspect each web page before it is sent to the client. SteelApp checks to see if the page has been selected for analysis by
SteelCentral Web Analyzer, and then constructs the JavaScript fragment and injects into the web page at the right place in the
HTML document.
When the web page arrives at the client browser, the JavaScript snippet is executed, builds a complete profile, with end-to-end
user experience timing information, and forwards the information to the SaaS platform managed by Riverbed, and results
analyzed via the SteelCentral Web Analyzer web portal.
© 2014 Riverbed Technology. All rights reserved
5
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
Because SteelApp software makes it easy to construct powerful rules to construct JavaScript snippets in real time, it is possible to
have much more control over how and when which web pages are tracked, and to insert session-level information for even deeper
analysis. While SteelCentral Web Analyzer includes tools to analyze and filter ALL application transactions, there may be
occasions when you need to apply the rules to only a subset of the transactions. For example:
•
Dynamic Selection: Construct rules which are applied to a subset of web pages, a specific group of users, or a combination
of conditions such as time-of-day and geographic location
•
Insert user information: Inject additional information, such as the user cookie for the session, so application performance
can be correlated to an end user without sharing sensitive information.
•
Insert session-level data: Inject session information, such as the name of the server node which was used to send the web
page or server the transaction, to drill down into the application infrastructure.
•
A/B testing: Use SteelApp to partition users into different populations, each of which will be routed by SteelApp to alternate
versions of the application. SteelApp can tag the transactions with the version of the applications which served the
transactions, allowing a direct comparison of the performance of the two versions of the applications.
© 2014 Riverbed Technology. All rights reserved
6
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
2.0 Configuring SteelApp to inject a JavaScript snippet into your application
Follow these steps to configure SteelApp to inject the JavaScript snippet into your application:
•
•
•
Copy the JavaScript snippet for your application
Create a TrafficScript rule in SteelApp
Enable the rule, and monitor your application
2.1 Create the JavaScript probe snippet for your application
The first step to instrumenting any application with SteelCentral Web Analyzer is to get the JavaScript snippet for your application.
Log in to ARX SaaS console via https://appresponse.opnet.com/web/browsermetrix.jsp and simply create a new application, or
go to the settings page for an existing application. You can copy and paste the JavaScript snippet directly from the screen into the
rule we create below. An example JavaScript snippet might look like this (but with your own clientId and appId values)
<script> var OPNET_ARXS={startJS:Number(new Date()), clientId:"ABCD1234EFGH5678",appId:123456}; (function(){ ..... })(); </script> In order to use this in our TrafficScript rule, we need to assign this JavaScript snippet to a string that can be used by SteelApp to
insert into the completed HTML document to be returned to the client browser:
# Extract: converting JavaScript snippet to a string for TrafficScript rule $script = "\n<script> if(!OPNET_ARXS){ " . "var OPNET_ARXS={startJS:Number(new Date()), " . "clientId:'ABCD1234EFGH5678', appId:123456, " . "collector:'eue.collect-­‐opnet.com', " . "sv:'0302', " . "username:''}; " . "(function(){ " . "var w=window,l=w.addEventListener,m=w.attachEvent, " . "d=document,s='script',t='load',o=OPNET_ARXS, " . "z='-­‐0b2c4d73f58414c86c7384150be8ca44', " . "r=(('https:'===d.location.protocol)? " . "'https://953c27ce3b34cfb8cc56'+z+'.ssl': " . "'http://fb3f316d487bcc59f7ec'+z+'.r88')+ " . "'.cf1.rackcdn.com/opnet_browsermetrix.c.'+ " . "(o.ajax?'ajax.js':'js'),p=('onpagehide' in w),e=p?'pageshow':t, " . "j=d.createElement(s),x=d.getElementsByTagName(s)[0], " . "h=function(y){o.ldJS=new Date();o.per=y?y.persisted:null;}, " . "i=function(){o.ld=1;};o.cookie=d.cookie;d.cookie= " . "'_op_aixPageId=0; path=/; expires='+(new Date(0)).toGMTString(); " . "o.cookieAfterDelete=d.cookie;j.async=1;j.src=r; " . "if(l){l(e,h,false);if(p){l(t,i,false);}}else if(m) " . "{m('on'+e,h);if(p){m('on'+t,i);}} " . "if(o.sync){d.write('<'+s+' src=\\''+r+'\\'></'+s+'>');} " . "else{x.parentNode.insertBefore(j,x);} " . "})();} " . "</script>"; Three changes need to be made to the JavaScript snippet pasted from the AppResponse portal: (1) all double-quote characters
need to be escaped with a “\” symbol, and (2) a newline continuation or concatenation needs to be added to the end of each line
of the script, and (3) the whole is assigned to a string variable $script so we can include in the simple TrafficScript rule.
© 2014 Riverbed Technology. All rights reserved
7
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
2.2 Create a simple TrafficScript rule in SteelApp
We need to add the JavaScript snippet to every web page, just after the opening <head> tag. This simple TrafficScript response
rule performs the following actions:
•
•
•
Check that the response is an HTML document: we do not need to put the tracking code in other types of response;
Assign our JavaScript snippet to a string variable $script ready to insert;
Read the response body, search for the opening <head> tag and insert the JavaScript code;
Configure it as a response rule for the virtual server managing your web traffic, named something like “OPNET ARX JS injection”
and ensure that web pages now have the JavaScript snippet injected immediately after the <head> tag in the HTML document:
# A simple TrafficScript rule to insert our JavaScript snippet # Check that this is an HTML document $contentType = http.getResponseHeader( "Content-­‐Type" ); if( ! string.startsWith( $contentType, "text/html" ) ) break; # Capture the body of the HTML document and assign # the ARX JavaScript snippet to the $script variable $body = http.getResponseBody(); $script = "\n<script> if(!OPNET_ARXS){ " . "var OPNET_ARXS={startJS:Number(new Date()), " . "clientId:'ABCD1234EFGH5678', appId:123456, " . "collector:'eue.collect-­‐opnet.com', " . "sv:'0302', " . "username:''}; " . "(function(){ " . "var w=window,l=w.addEventListener,m=w.attachEvent, " . "d=document,s='script',t='load',o=OPNET_ARXS, " . "z='-­‐0b2c4d73f58414c86c7384150be8ca44', " . "r=(('https:'===d.location.protocol)? " . "'https://953c27ce3b34cfb8cc56'+z+'.ssl': " . "'http://fb3f316d487bcc59f7ec'+z+'.r88')+ " . "'.cf1.rackcdn.com/opnet_browsermetrix.c.'+ " . "(o.ajax?'ajax.js':'js'),p=('onpagehide' in w),e=p?'pageshow':t, " . "j=d.createElement(s),x=d.getElementsByTagName(s)[0], " . "h=function(y){o.ldJS=new Date();o.per=y?y.persisted:null;}, " . "i=function(){o.ld=1;};o.cookie=d.cookie;d.cookie= " . "'_op_aixPageId=0; path=/; expires='+(new Date(0)).toGMTString(); " . "o.cookieAfterDelete=d.cookie;j.async=1;j.src=r; " . "if(l){l(e,h,false);if(p){l(t,i,false);}}else if(m) " . "{m('on'+e,h);if(p){m('on'+t,i);}} " . "if(o.sync){d.write('<'+s+' src=\\''+r+'\\'></'+s+'>');} " . "else{x.parentNode.insertBefore(j,x);} " . "})();} " . "</script>"; # Insert the JavaScript snippet immediately after the <HEAD> element if( string.regexmatch( $body, "^(.*?)(<head.*?>)(.*)$", "i" ) ) { http.setResponseBody( $1 . $2 . $script . $3 ); } © 2014 Riverbed Technology. All rights reserved
8
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
2.3 Building an advanced TrafficScript rule
SteelApp TrafficScript can instrument multiple applications, or just a subset of those applications using a single rule, and insert the
correct clientId and appId values for each application. The rule below is used as the template for later examples in this
document, and shows how to assemble the JavaScript snippet to include the clientId and appId values. The key differences
over the simple example in the previous section are:
•
•
•
The rule starts with a hash table, which lists each of the applications,
with corresponding clientId and appId values for each application
The rule checks the HTTP request header to see if it one of those in the hash table
If we have a match, then we create the JavaScript snippet including the clientId and appId from the hash table
# A virtual server can manage multiple hosts, each of which you can # monitor individually by creating a new Application for each host # The below hash table keys your host names to their associated # clientId and appId *Change with your values* $hostProfile = [ # Host name clientId appId "www.mywebsite.com" => ["ABCD1234EFGH5678", "123456"] ]; # Check that this is an HTML document $contentType = http.getResponseHeader( "Content-­‐Type" ); if( ! string.startsWith( $contentType, "text/html" ) ) break; # Check that this matches one of the hostnames we want to instrument $hostHeader = http.getHeader( "Host" ); $host = $hostProfile[$hostHeader]; if( !$host ) break; # Extract the clientId and appId for this host $clientId = $host[0]; $appId= $host[1]; # Capture the body of the HTML document and assign # the ARX JavaScript snippet to the $script variable $body = http.getResponseBody(); $script = "\n<script> if(!OPNET_ARXS){ " . "var OPNET_ARXS={startJS:Number(new Date()), " . "clientId:'" . $clientId . "',appId:" . $appId . ", " . "collector:'eue.collect-­‐opnet.com', " . "sv:'0302', " . "username:''}; " . "(function(){ " . "var w=window,l=w.addEventListener,m=w.attachEvent, " . "d=document,s='script',t='load',o=OPNET_ARXS, " . "z='-­‐0b2c4d73f58414c86c7384150be8ca44', " . "r=(('https:'===d.location.protocol)? " . "'https://953c27ce3b34cfb8cc56'+z+'.ssl': " . "'http://fb3f316d487bcc59f7ec'+z+'.r88')+ " . "'.cf1.rackcdn.com/opnet_browsermetrix.c.'+ " . "(o.ajax?'ajax.js':'js'),p=('onpagehide' in w),e=p?'pageshow':t, " . "j=d.createElement(s),x=d.getElementsByTagName(s)[0], " . "h=function(y){o.ldJS=new Date();o.per=y?y.persisted:null;}, " . "i=function(){o.ld=1;};o.cookie=d.cookie;d.cookie= " . "'_op_aixPageId=0; path=/; expires='+(new Date(0)).toGMTString(); " . "o.cookieAfterDelete=d.cookie;j.async=1;j.src=r; " . "if(l){l(e,h,false);if(p){l(t,i,false);}}else if(m) " . "{m('on'+e,h);if(p){m('on'+t,i);}} " . "if(o.sync){d.write('<'+s+' src=\\''+r+'\\'></'+s+'>');} " . "else{x.parentNode.insertBefore(j,x);} " . "})();} " . "</script>"; © 2014 Riverbed Technology. All rights reserved
9
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
2.4 Using the power of TrafficScript rules to decide when and how inject JavaScript
Because TrafficScript is so easy to use, you can create a range of different scenarios to instrument your web application in
different ways. In the example above, we created a simple script to insert our JavaScript snippet into every page on a website. In
the following sections, we will look at three potential scenarios which you can use to extend SteelCentral Web Analyzer SaaS
using TrafficScript to build dynamic snippets into your application:
1.
Instrument only a specific range of pages
2.
Add additional metadata to track session-level information
3.
Use SteelApp to support A/B testing and measurement
2.4.1. Instrument only a specific range of pages
In another simple example, we might only want to instrument a small range of pages. For example, we might only want to inject
the JavaScript snippet into pages on the “Product” section of the website. To do this, we simple simply have an extra condition at
the start of the TrafficScript rule to identify the pages we want to modify.
In this case, we only want to instrument pages which are part of the “/products” section of our web site:
# If this is not one of the pages we want to track, then break # The “break” causes the execution of the rule to stop $rawurl = http.getRawURL(); if( ! string.contains( $rawurl, "/products" ) ) { break; } TrafficScript makes it easy to create rules to cover any scenario: you could write rules that test the time of day, rules which only
inject JavaScript when the request is from a specific sender, rules to trigger on content type, or even the geographic origin.
Original HTML document Inject <html><body>
...document content
...no changes to the app
</body></html>
JavaScript snippet <script>
var OPNET_ARXS={startJS:Number(new Date()),
clientId:"ABCD1234EFGH5678",appId:123456}};
(function(){
...........
})();
</script>
© 2014 Riverbed Technology. All rights reserved
Modify 10
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
2.4.2 Add additional metadata to track session-level information
SteelApp can also capture real-time information about the session, and add extra fields to be captured downstream as part of the
ARX user experience analysis. Recall that a typical ARX JavaScript snippet looks something like this:
<script> var OPNET_ARXS={startJS:Number(new Date()), clientId:"ABCD1234EFGH5678",appId:123456,username:"johndoe"}}; (function(){ ... })(); </script> In this example, you can see that we have added an extra field in the opening line: besides the clientId and appId
provided by SteelCentral in the snippet, we have added an extra username field. This technique can be used to add metadata
which can be analysed as part of the end-to-end user experience by SteelCentral SaaS. For more information on how to extend
the metadata in this way, see Riverbed’s documentation on how to add additional fields, entitled “Embedding JavaScript
Snippets.”
TrafficScript provides a number of tools to capture session-level information, including user names. This short request rule can be
used to extract the username from a form and insert as a cookie named “ARX-username” for passing session-level information:
# TrafficScript Request Rule – Simple version # Extract the login information and save it to a cookie named "ARX-­‐username". $body = http.getBody(); $host = http.getHeader( "Host" ); if (http.getFormParam( "user-­‐field-­‐id" )) { $username = http.getFormParam( "user-­‐field-­‐id" ); http.setResponseCookie("ARX-­‐username", $username, "domain=". $host . ";path=/"); } You may need to adjust this request rule to extract the user information for your particular application. For example, the Magento
eCommerce platform submits login information via a text string in a different format which requires more processing:
“login[username]=<username>&[password]=<password>”. The TrafficScript request rule below uses the regular
expression to extract the username and stores it in a cookie named “ARX-username”.
# TrafficScript Request Rule – Magento user name # Extract the login information using a regular expression # and save it to a cookie named "ARX-­‐username". $body = http.getBody(); $host = http.getHeader( "Host" ); if (string.regexmatch($body, "^login.*?username%5d=(.*?)&.*$", "i")) { $username = $1; http.setResponseCookie("ARX-­‐username", $username, "domain=". $host . ";path=/"); } Once the cookie is set the below response rule will request the cookie and insert the username into the Web Analyzer JavaScript
snippet:
© 2014 Riverbed Technology. All rights reserved
11
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
# A virtual server can manage multiple hosts, each of which you can # monitor individually by creating a new Application for each host # # The below hash table keys your host names to their associated # clientId and appId *Change with your values* $hostProfile = [ # Host name clientId appId "www.mywebsite.com" => ["ABCD1234EFGH5678", "123456"] ]; # Check that this is an HTML document $contentType = http.getResponseHeader( "Content-­‐Type" ); if( ! string.startsWith( $contentType, "text/html" ) ) break; # Check that this matches one of the hostnames we want to instrument $hostHeader = http.getHeader( "Host" ); $host = $hostProfile[$hostHeader]; if( !$host ) break; # Extract the clientId and appId for this host $clientId = $host[0]; $appId= $host[1]; # Get the User Name from the ARX-­‐username cookie $username = http.getCookie("ARX-­‐username"); # Capture the body of the HTML document and assign # the ARX JavaScript snippet to the $script variable $body = http.getResponseBody(); $script = "\n<script> if(!OPNET_ARXS){ " . "var OPNET_ARXS={startJS:Number(new Date()), " . "clientId:'" . $clientId . "',appId:" . $appId . ", " . "collector:'eue.collect-­‐opnet.com', " . "sv:'0302', " . "username:''}; " . "(function(){ " . "var w=window,l=w.addEventListener,m=w.attachEvent, " . "d=document,s='script',t='load',o=OPNET_ARXS, " . "z='-­‐0b2c4d73f58414c86c7384150be8ca44', " . "r=(('https:'===d.location.protocol)? " . "'https://953c27ce3b34cfb8cc56'+z+'.ssl': " . "'http://fb3f316d487bcc59f7ec'+z+'.r88')+ " . "'.cf1.rackcdn.com/opnet_browsermetrix.c.'+ " . "(o.ajax?'ajax.js':'js'),p=('onpagehide' in w),e=p?'pageshow':t, " . "j=d.createElement(s),x=d.getElementsByTagName(s)[0], " . "h=function(y){o.ldJS=new Date();o.per=y?y.persisted:null;}, " . "i=function(){o.ld=1;};o.cookie=d.cookie;d.cookie= " . "'_op_aixPageId=0; path=/; expires='+(new Date(0)).toGMTString(); " . "o.cookieAfterDelete=d.cookie;j.async=1;j.src=r; " . "if(l){l(e,h,false);if(p){l(t,i,false);}}else if(m) " . "{m('on'+e,h);if(p){m('on'+t,i);}} " . "if(o.sync){d.write('<'+s+' src=\\''+r+'\\'></'+s+'>');} " . "else{x.parentNode.insertBefore(j,x);} " . "})();} " . "</script>"; # Insert the JavaScript snippet immediately after the <HEAD> element if( string.regexmatch( $body, "^(.*?)(<head.*?>)(.*)$", "i" ) ) { http.setResponseBody( $1 . $2 . $script . $3 ); } © 2014 Riverbed Technology. All rights reserved
12
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
2.4.3. Use SteelApp to support A/B testing and measurement
In this article, we have looked at how you can use SteelApp to inject dynamic JavaScript snippets into a web application, without
changing the application itself. However, one of the ways that SteelApp can be used is to select out traffic for testing of new
applications in parallel with the existing application. When combined with SteelCentral Web Analyzer, it is possible to perform “A/B
testing” – selecting out one part of the user population to use the new version of an application, and then using SteelCentral Web
Analyzer to measure the end-to-end user experience of the old application compared to the new version.
So at first, we can use SteelApp to select whether an incoming request would be directed to the A or B application; in this
example, we inspect a cookie to decide whether this is one of our test group of users (“B”): we will assume that the new
application is hosted on a separate hostname.
# Incoming rule to determine which test group to route request $testcookie = http.getCookie( "AB-­‐test-­‐cookie" ); if( string.contains( $testcookie, "groupA" )) { pool.select("Pool A"); } else { pool.select("Pool B"); } And then we can insert the test group into the JavaScript snippet in the HTML page returned to the user, so that ARX now has a
complete record of the end-to-end user experience, and can compare the experience improvement of the new service “B” over the
original “A”
© 2014 Riverbed Technology. All rights reserved
13
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
# A virtual server can manage multiple hosts, each of which you can # monitor individually by creating a new Application for each host # # The below hash table keys your host names to their associated # clientId and appId *Change with your values* $hostProfile = [ # Host name clientId appId "www.mywebsite.com" => ["ABCD1234EFGH5678", "123456"] ]; # Check that this is an HTML document $contentType = http.getResponseHeader( "Content-­‐Type" ); if( ! string.startsWith( $contentType, "text/html" ) ) break; # Check that this matches one of the hostnames we want to instrument $hostHeader = http.getHeader( "Host" ); $host = $hostProfile[$hostHeader]; if( !$host ) break; # Extract the clientId and appId for this host $clientId = $host[0]; $appId= $host[1]; # Incoming rule to determine which test group to route request $testcookie = http.getCookie( "AB-­‐test-­‐cookie" ); # Capture the body of the HTML document and assign # the ARX JavaScript snippet to the $script variable $body = http.getResponseBody(); $script = "\n<script> if(!OPNET_ARXS){ " . "var OPNET_ARXS={startJS:Number(new Date()), " . "clientId:'" . $clientId . "',appId:" . $appId . ", " . "collector:'eue.collect-­‐opnet.com', " . "sv:'0302', " . "username:''}; " . "(function(){ " . "var w=window,l=w.addEventListener,m=w.attachEvent, " . "d=document,s='script',t='load',o=OPNET_ARXS, " . "z='-­‐0b2c4d73f58414c86c7384150be8ca44', " . "r=(('https:'===d.location.protocol)? " . "'https://953c27ce3b34cfb8cc56'+z+'.ssl': " . "'http://fb3f316d487bcc59f7ec'+z+'.r88')+ " . "'.cf1.rackcdn.com/opnet_browsermetrix.c.'+ " . "(o.ajax?'ajax.js':'js'),p=('onpagehide' in w),e=p?'pageshow':t, " . "j=d.createElement(s),x=d.getElementsByTagName(s)[0], " . "h=function(y){o.ldJS=new Date();o.per=y?y.persisted:null;}, " . "i=function(){o.ld=1;};o.cookie=d.cookie;d.cookie= " . "'_op_aixPageId=0; path=/; expires='+(new Date(0)).toGMTString(); " . "o.cookieAfterDelete=d.cookie;j.async=1;j.src=r; " . "if(l){l(e,h,false);if(p){l(t,i,false);}}else if(m) " . "{m('on'+e,h);if(p){m('on'+t,i);}} " . "if(o.sync){d.write('<'+s+' src=\\''+r+'\\'></'+s+'>');} " . "else{x.parentNode.insertBefore(j,x);} " . "})();} " . "</script>"; # Insert the JavaScript snippet immediately after the <HEAD> element if( string.regexmatch( $body, "^(.*?)(<head.*?>)(.*)$", "i" ) ) { http.setResponseBody( $1 . $2 . $script . $3 ); } © 2014 Riverbed Technology. All rights reserved
14
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
3.0 Programmable Infrastructure with Riverbed SteelScript
Riverbed SteelScript is a powerful set of developer tools that enables a broad range of integrations and customizations of the
Riverbed performance platform, including:
•
•
•
•
Scripting and automation
Custom visibility and control
Software-defined data centers
Integration between Riverbed products and third-party tools
The SteelScript for Python includes examples of control and integration, and includes a Python script to automate the process of
creating a new TrafficScript rule to inject JavaScript for end-user experience monitoring. Riverbed Splash has an article with more
information on Getting Started with SteelScript. Once SteelScript is installed on your system, the example Python script can be
found in the folder examples/SteelApp/appresponse_setup.py. To use the script, simply run:
python examples/SteelApp/appresponse_setup.py STEELAPP_HOSTNAME <parameters> Where STEELAPP_HOSTNAME is the ip address or hostname of our SteelApp Traffic Manager and the <parameters> are as
follows:
•
•
•
•
•
•
-u: Your SteelApp Traffic Manager Username - the same as you use to login in to the SteelApp Traffic Manager Web
Interface.
-p: Your SteelApp Traffic Manager Password - the same as you use to login in to the SteelApp Traffic Manager Web
Interface.
--clientid: Your Opnet SteelCentral Web AnalyzerclientId. – as found on the Settings page of your AppResponse Application.
--appid: Your Opnet SteelCentral Web AnalyzerappId. – as found on the Settings page of your AppResponse Application.
--vserver: The Virtual Server to attach the script to.
--host: (optional) Restrict AppResponse to this particular host.
The complete script can be found in the SteelScript for Python, file examples/SteelApp/appresponse_setup.py
An example usage for a real implementation is shown below:
python examples/SteelApp/appresponse_setup.py 10.32.162.50 -­‐u admin -­‐p password -­‐-­‐
clientid=ABCD1234EFGH5678 -­‐-­‐appid=123456 -­‐-­‐vserver=nl -­‐-­‐host=www.northernlightsastronomy.com 4.0 Conclusion
This document briefly discusses how to configure SteelApp Traffic Manager with SteelCentral Web Analyzer to monitor and load
balance web application traffic, and to build dynamic tracking tools to monitor session-level information using the same SaaS tool
for end user experience monitoring.
SteelApp Traffic Manager is able to manage traffic in a wide variety of ways, by improving the performance, security, reliability and
the integrity of application traffic. Please refer to the product documentation on the Riverbed Community Forums for examples of
how SteelApp Traffic Manager and the complete Riverbed Performance Platform (RPM) can be deployed to meet a range of
service hosting challenges: (http://splash.riverbed.com)
© 2014 Riverbed Technology. All rights reserved
15
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
Appendix A – A simple template rule
SteelApp Traffic Manager includes several ways to build powerful rules, and it is very easy to implement complex policies using
the built-in TrafficScript language. In this deployment guide, we have showed how to create a flexible rule to inject JavaScript into
web pages to track the end-to-end performance and measure the actual user experience, and how to customize it to create
dynamic instrumentation for a variety of use cases. To make this even easier, we have created a simple, encapsulated rule which
can be copied directly into SteelApp Traffic Manager, and includes a form to let you customize the rule to include your own
ClientID and AppID in the JavaScript snippet.
To find this template rule, visit the Riverbed Splash community site at:
https://splash.riverbed.com/docs/DOC-4575
In this example, we will add the new rule to our example web site, “http://www.northernlightsastronomy.com” using the following
steps:
A1. Create the new rule
The quickest way to create a new rule on the SteelApp Traffic Manager console is to navigate to the virtual server for your web
application, click through to the Rules linked to this virtual server, and then at the foot of the page, click “Manage Rules in
Catalog.” Type in a name for your new rule, ensure the “Use TrafficScript” and “Associate with this virtual server” options are
checked, then click on “Create Rule”
A2. Copy in the encapsulated rule
In the new rule, simply copy and paste in the encapsulated rule, and click on “Update” at the end of the form:
© 2014 Riverbed Technology. All rights reserved
16
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
A3. Customize the rule
The rule is now transformed into a simple form which you can customize, and you can enter in the “clientId” and “appId”
parameters from the Web Analyzer – BrowserMetrix console. In addition, you must enter the ‘hostname’ which SteelApp Traffic
Manager uses to serve the web pages. Enter the hostname, but exclude any prefix such as “http://” or https:// and enter only the
hostname itself.
The new rule is now enabled for your application, and you can track via the SteelCentral Web Analyzer console.
© 2014 Riverbed Technology. All rights reserved
17
DEPLOYMENT GUIDE: Using SteelApp Traffic Manager with SteelCentral Web Analyzer
Appendix B – How to find your clientId and appId parameters
Creating and modifying your JavaScript snippet requires that you enter the “clientId” and “appId” parameters from the Web
Analyzer – BrowserMetrix console. To do this, go to the home page, and click on the “Application Settings” icon next to your
application:
The next screen shows the plain JavaScript snippet – from this, you can copy the “clientId” and “appId” parameters:
© 2014 Riverbed Technology. All rights reserved.
Riverbed delivers performance for the globally connected enterprise. With Riverbed, enterprises can successfully and intelligently implement strategic initiatives
such as virtualization, consolidation, cloud computing, and disaster recovery without fear of compromising performance. By giving enterprises the platform they
need to understand, optimize and consolidate their IT, Riverbed helps enterprises to build a fast, fluid and dynamic IT architecture that aligns with the business
needs of the organization. Additional information about Riverbed (NASDAQ: RVBD) is available at www.riverbed.com.
Akamai® and the Akamai wave logo are registered trademarks of Akamai Technologies, Inc. SureRoute is a service mark of Akamai. Apple and Mac are
registered trademarks of Apple, Incorporated in the United States and in other countries. Cisco is a registered trademark of Cisco Systems, Inc. and its affiliates in
the United States and in other countries. EMC, Symmetrix, and SRDF are registered trademarks of EMC Corporation and its affiliates in the United States and in
other countries. IBM, iSeries, and AS/400 are registered trademarks of IBM Corporation and its affiliates in the United States and in other countries. Linux is a
trademark of Linus Torvalds in the United States and in other countries. Microsoft, Windows, Vista, Outlook, and Internet Explorer are trademarks or registered
trademarks of Microsoft Corporation in the United States and in other countries. Oracle and JInitiator are trademarks or registered trademarks of Oracle
Corporation in the United States and in other countries. UNIX is a registered trademark in the United States and in other countries, exclusively licensed through
X/Open Company, Ltd. VMware, ESX, ESXi are trademarks or registered trademarks of VMware, Incorporated in the United States and in other countries.
Riverbed Technology, Inc.
199 Fremont Street
San Francisco, CA 94105
Tel: (415) 247-8800
www.riverbed.com
© 2014 Riverbed Technology. All rights reserved
Riverbed Technology Ltd.
One Thames Valley
Wokingham Road, Level 2
Bracknell. RG42 1NG
United Kingdom
Tel: +44 1344 31 7100
Riverbed Technology Pte. Ltd.
391A Orchard Road #22-06/10
Ngee Ann City Tower A
Singapore 238873
Tel: +65 6508-7400
Riverbed Technology K.K.
Shiba-Koen Plaza Building 9F
3-6-9, Shiba, Minato-ku
Tokyo, Japan 105-0014
Tel: +81 3 5419 1990
18