Modified: jmeter/trunk/docs/usermanual/realtime-results.html URL: http://svn.apache.org/viewvc/jmeter/trunk/docs/usermanual/realtime-results.html?rev=1739469&r1=1739468&r2=1739469&view=diff ============================================================================== --- jmeter/trunk/docs/usermanual/realtime-results.html (original) +++ jmeter/trunk/docs/usermanual/realtime-results.html Sat Apr 16 14:36:00 2016 @@ -1,23 +1,12 @@ <!DOCTYPE html SYSTEM "about:legacy-compat"> <html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-15"><title>Apache JMeter - - User's Manual: Live Statistics</title><meta name="author" value="Philippe Mouawad"><meta name="email" value="p.mouawad at ubik-ingenierie.com"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="http://fonts.googleapis.com/css?family=Merriweather:400normal" rel="stylesheet" type="text/css"><link rel="stylesheet" type="text/css" href="../css/new-style.css"></head><body role="document"><a href="#content" class="hidden">Main content</a><div class="header"><!-- + User's Manual: Live Statistics</title><meta name="author" value="Philippe Mouawad"><meta name="email" value="p.mouawad at ubik-ingenierie.com"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="http://fonts.googleapis.com/css?family=Merriweather:400normal" rel="stylesheet" type="text/css"><link rel="stylesheet" type="text/css" href="../css/new-style.css"><link rel="apple-touch-icon-precomposed" href="../images/apple-touch-icon.png"><link rel="icon" href="../images/favicon.png"><meta name="msapplication-TileColor" content="#ffffff"><meta name="msapplication-TileImage" content="../images/mstile-144x144.png"><meta name="theme-color" content="#ffffff"></head><body role="document"><a href="#content" class="hidden">Main content</a><div class="header"><!-- APACHE LOGO - --><div><a href="http://www.apache.org"><img title="Apache Software Foundation" width="290" height="75" src="../images/asf-logo.png" alt="Logo ASF"></a></div><!-- + --><div><a href="http://www.apache.org"><img title="Apache Software Foundation" class="logo" src="../images/asf-logo.svg" alt="Logo ASF"></a></div><!-- PROJECT LOGO - --><div><a href="http://jmeter.apache.org/"><img src="../images/logo.jpg" alt="Apache JMeter"></a></div><div class="twitter"><div><a href="https://twitter.com/share" class="twitter-share-button" data-text="Powerful Load Testing with Apache #JMeter" data-via="ApacheJMeter" data-lang="en-gb" data-size="large">Tweet</a><script> - (function(d,s,id){ - var js, - fjs=d.getElementsByTagName(s)[0], - p=/^http:/.test(d.location)?'http':'https'; - if (!d.getElementById(id)) { - js=d.createElement(s); - js.id=id; - js.src=p+'://platform.twitter.com/widgets.js'; - fjs.parentNode.insertBefore(js,fjs); - } - })(document, 'script', 'twitter-wjs'); - </script></div><div><a href="https://twitter.com/ApacheJMeter" class="twitter-follow-button" data-show-count="false" data-lang="en-gb" data-size="large">Follow</a><script>(function(d,s,id){ + --><div><a href="http://jmeter.apache.org/"><img class="logo" src="../images/logo.svg" alt="Apache JMeter"></a></div><div class="banner"><iframe src="http://www.apache.org/ads/bannerbar.html" style="border-width:0;" frameborder="0" scrolling="no"></iframe><div class="clear"></div></div></div><div class="nav"><div class="social menu"><div><a href="https://twitter.com/share" class="twitter-share-button" data-text="Powerful Load Testing with Apache #JMeter" data-via="ApacheJMeter" data-lang="en-gb" data-size="large">Tweet</a><script> + (function(d,s,id){ var js, fjs=d.getElementsByTagName(s)[0], p=/^http:/.test(d.location)?'http':'https'; @@ -27,10 +16,21 @@ js.src=p+'://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js,fjs); } - })(document, 'script', 'twitter-wjs'); - </script></div></div><div class="banner"><iframe src="http://www.apache.org/ads/bannerbar.html" style="border-width:0;" frameborder="0" scrolling="no"></iframe><div class="clear"></div></div></div><div class="nav"><ul class="menu"><li><div class="menu-title">About</div><ul><li><a href="../index.html">Overview</a></li><li><a href="http://twitter.com/ApacheJMeter">JMeter on Twitter<img src="../images/twitter.png" alt="Icon for JMeter on Twitter"></a></li><li><a href="../issues.html">Issue Tracking</a></li><li><a href="http://projects.apache.org/feeds/rss/jmeter.xml">Subscribe to What's New</a></li><li><a href="http://www.apache.org/licenses/">License</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Download</div><ul><li><a href="../download_jmeter.cgi">Download Releases</a></li><li><a href="../nightly.html">Developer (Nightly) Builds</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Documentation</div><ul><li><a href="../changes.html" >Changes per version</a></li><li><a href="../usermanual/get-started.html">Get >Started</a></li><li><a href="../usermanual/index.html">User >Manual</a></li><li><a href="../usermanual/best-practices.html">Best >Practices</a></li><li><a >href="../usermanual/component_reference.html">Component >Reference</a></li><li><a href="../usermanual/functions.html">Functions >Reference</a></li><li><a href="../api/index.html">Javadocs</a></li><li><a >href="../building.html">Building JMeter and Add-Ons</a></li><li><a >href="http://wiki.apache.org/jmeter">JMeter Wiki</a></li><li><a >href="http://wiki.apache.org/jmeter/JMeterFAQ">FAQ >(Wiki)</a></li></ul></li></ul><ul class="menu"><li><div >class="menu-title">Tutorials (PDF format)</div><ul><li><a >href="../usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed >Testing</a></li><li><a >href="../usermanual/jmeter_proxy_step_by_step.pdf">Recording >Tests</a></li><li><a href="../usermanual/junitsampler_tutorial.pdf">JUnit >Sampler</a></li><li><a href="../us ermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log Sampler</a></li><li><a href="../extending/jmeter_tutorial.pdf">Extending JMeter</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Community</div><ul><li><a href="http://wiki.apache.org/jmeter/JMeterCommitters">Contributors</a></li><li><a href="../mail.html">Mailing Lists</a></li><li><a href="../svnindex.html">SVN Repositories</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Foundation</div><ul><li><a href="http://www.apache.org/">ASF</a></li><li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved in the ASF</a></li><li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></li></ul></div><div class="main" id="content"><ul class="pagelinks"><li><a href="live-statistics.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="component_refer ence.html">Next ></a></li></ul><div class="section"><h1 id="realtime-results">17. Real-time results<a class="sectionlink" href="#realtime-results" title="Link to here">¶</a></h1> + })(document, 'script', 'twitter-wjs'); + </script></div><div><a href="https://twitter.com/ApacheJMeter" class="twitter-follow-button" data-show-count="false" data-lang="en-gb" data-size="large">Follow</a><script>(function(d,s,id){ + var js, + fjs=d.getElementsByTagName(s)[0], + p=/^http:/.test(d.location)?'http':'https'; + if (!d.getElementById(id)) { + js=d.createElement(s); + js.id=id; + js.src=p+'://platform.twitter.com/widgets.js'; + fjs.parentNode.insertBefore(js,fjs); + } + })(document, 'script', 'twitter-wjs'); + </script></div><div><a href="https://github.com/apache/jmeter"><img alt="star this repo" src="http://githubbadges.com/star.svg?user=apache&repo=jmeter&style=default"></a></div><div><a href="https://github.com/apache/jmeter/fork"><img alt="fork this repo" src="http://githubbadges.com/fork.svg?user=apache&repo=jmeter&style=default"></a></div><div><a href="https://maven-badges.herokuapp.com/maven-central/org.apache.jmeter/ApacheJMeter"><img alt="Maven Central" src="https://maven-badges.herokuapp.com/maven-central/org.apache.jmeter/ApacheJMeter/badge.png"></a></div></div><ul class="menu"><li onClick="return true"><div class="menu-title">About</div><ul><li><a href="../index.html">Overview</a></li><li><a href="http://www.apache.org/licenses/">License</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Download</div><ul><li><a href="../download_jmeter.cgi">Download Releases</a></li><li><a href="../nightly.html">Developer (Nightly) Builds</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Documentation</div><ul><li><a href="../changes.html">Changes per version</a></li><li><a href="../usermanual/get-started.html">Get Started</a></li><li><a href="../usermanual/index.html">User Manual</a></li><li><a href="../usermanual/best-practices.html">Best Practices</a></li><li><a href="../usermanual/component_reference.html">Component Reference</a></li><li><a href="../usermanual/functions.html">Functions Reference</a></li><li><a href="../api/index.html">Javadocs</a></li><li><a href="../building.html">Building JMeter and Add-Ons</a></li><li><a href="http://wiki.apache.org/jmeter">JMeter Wiki</a></li><li><a href="http://wiki.apache.org/jmeter/JMeterFAQ">FAQ (Wiki)</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Tutorials (PDF format)</div><ul><li><a href="../usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed Testing</a ></li><li><a href="../usermanual/jmeter_proxy_step_by_step.pdf">Recording >Tests</a></li><li><a href="../usermanual/junitsampler_tutorial.pdf">JUnit >Sampler</a></li><li><a >href="../usermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log >Sampler</a></li><li><a href="../extending/jmeter_tutorial.pdf">Extending >JMeter</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div >class="menu-title">Community</div><ul><li><a href="../issues.html">Issue >Tracking</a></li><li><a href="../mail.html">Mailing Lists</a></li><li><a >href="../svnindex.html">Source Repositories</a></li><li><a >href="../building.html">Building and Contributing</a></li><li><a >href="https://projects.apache.org/project.html?jmeter">Project info at >Apache</a></li><li><a >href="http://wiki.apache.org/jmeter/JMeterCommitters">Contributors</a></li></ul></li></ul><ul > class="menu"><li onClick="return true"><div >class="menu-title">Foundation</div><ul><li><a >href="http://www.apache.org/">ASF</a></li><li><a href= "http://www.apache.org/foundation/getinvolved.html">Get Involved in the ASF</a></li><li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></li></ul></div><div class="main" id="content"><ul class="pagelinks"><li><a href="remote-test.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="best-practices.html">Next ></a></li></ul><div class="section"><h1 id="realtime-results">17. Real-time results<a class="sectionlink" href="#realtime-results" title="Link to here">¶</a></h1> <p>Since JMeter 2.13 you can get realtime results sent to a backend through the -<a href="component_reference.html#Backend_Listener">Backend Listener</a> using potentially any backend (JDBC, JMS, Webservice...) implementing <a href="../api/org/apache/jmeter/visualizers/backend/AbstractBackendListenerClient.html">AbstractBackendListenerClient</a>.<br> +<a href="component_reference.html#Backend_Listener">Backend Listener</a> using potentially any backend (JDBC, JMS, Webservice, …) implementing <a href="../api/org/apache/jmeter/visualizers/backend/AbstractBackendListenerClient.html">AbstractBackendListenerClient</a>.<br> JMeter ships with a GraphiteBackendListenerClient which allows you to send metrics to a Graphite Backend.<br> This feature provides: <ul> @@ -38,7 +38,7 @@ This feature provides: <li>Nice graphs for metrics</li> <li>Ability to compare 2 or more load tests</li> <li>Storing monitoring data as long as JMeter results in the same backend</li> -<li>...</li> +<li>…</li> </ul> In this document we will present the configuration setup to graph and historize the data in 2 different backends: <ul> @@ -46,181 +46,139 @@ In this document we will present the con <li>Graphite</li> </ul> </p> -<div class="subsection"><h2>17.1 Metrics exposed<a class="sectionlink" href="#metrics" title="Link to here">¶</a></h2> - <div class="subsection"><h2>17.1.1 Thread/Virtual Users metrics<a class="sectionlink" href="#metrics-threads" title="Link to here">¶</a></h2> +<div class="subsection"><h2 id="metrics">17.1 Metrics exposed<a class="sectionlink" href="#metrics" title="Link to here">¶</a></h2> + <div class="subsection"><h2 id="metrics-threads">17.1.1 Thread/Virtual Users metrics<a class="sectionlink" href="#metrics-threads" title="Link to here">¶</a></h2> <p> Threads metrics are the following: </p> - <table> - <tr> - <th>Metric Name</th> - <th>Description</th> - </tr> - <tr> - <td><rootMetricsPrefix>.test.minAT</td> - <td>Min active threads</td> - </tr> - <tr> - <td><rootMetricsPrefix>.test.maxAT</td> - <td>Max active threads</td> - </tr> - <tr> - <td><rootMetricsPrefix>.test.meanAT</td> - <td>Mean active threads</td> - </tr> - <tr> - <td><rootMetricsPrefix>.test.startedT</td> - <td>Started threads</td> - </tr> - <tr> - <td><rootMetricsPrefix>.test.endedT</td> - <td>Finished threads</td> - </tr> - </table> + <dl> + <dt><span class="code"><rootMetricsPrefix>.test.minAT</span></dt><dd>Min active threads</dd> + <dt><span class="code"><rootMetricsPrefix>.test.maxAT</span></dt><dd>Max active threads</dd> + <dt><span class="code"><rootMetricsPrefix>.test.meanAT</span></dt><dd>Mean active threads</dd> + <dt><span class="code"><rootMetricsPrefix>.test.startedT</span></dt><dd>Started threads</dd> + <dt><span class="code"><rootMetricsPrefix>.test.endedT</span></dt><dd>Finished threads</dd> + </dl> </div> - <div class="subsection"><h2>17.1.2 Response times metrics<a class="sectionlink" href="#metrics-response-times" title="Link to here">¶</a></h2> - <p>Response times metrics are the following:</p> - <table> - <tr> - <th>Metric Name</th> - <th>Description</th> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.ok.count</td> - <td>Number of successful responses for sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.ok.min</td> - <td>Min response time for successful responses of sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.ok.max</td> - <td>Max response time for successful responses of sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.ok.pct<percentileValue></td> - <td>Percentile computed for successful responses of sampler name. You can input as many percentiles as you want (3 or 4 being a reasonable value).<br> - When percentile contains a comma for example "99.9", dot is sanitized by "_" leading to 99_9. - By default listener computes percentiles 90%, 95% and 99%</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.ko.count</td> - <td>Number of failed responses for sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.ko.min</td> - <td>Min response time for failed responses of sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.ko.max</td> - <td>Max response time for failed responses of sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.ko.pct<percentileValue></td> - <td>Percentile computed for failed responses of sampler name. You can input as many percentiles as you want (3 or 4 being a reasonable value).<br> - When percentile contains a comma for example "99.9", dot is sanitized by "_" leading to 99_9. - By default listener computes percentiles 90%, 95% and 99%</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.a.count</td> - <td>Number of responses for sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.a.min</td> - <td>Min response time for responses of sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.a.max</td> - <td>Max response time for responses of sampler name</td> - </tr> - <tr> - <td><rootMetricsPrefix>.<samplerName>.a.pct<percentileValue></td> - <td>Percentile computed for responses of sampler name. You can input as many percentiles as you want (3 or 4 being a reasonable value).<br> - When percentile contains a comma for example "99.9", dot is sanitized by "_" leading to 99_9. - By default listener computes percentiles 90%, 95% and 99%</td> - </tr> - </table> + <div class="subsection"><h2 id="metrics-response-times">17.1.2 Response times metrics<a class="sectionlink" href="#metrics-response-times" title="Link to here">¶</a></h2> + <p>Response related metrics are the following:</p> + <dl> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.ok.count</span></dt> + <dd>Number of successful responses for sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.h.count</span></dt> + <dd>Server hits per seconds, this metric cumulates Sample Result and Sub results (if using Transaction Controller, "Generate parent sampler" should be unchecked)</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.ok.min</span></dt> + <dd>Min response time for successful responses of sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.ok.max</span></dt> + <dd>Max response time for successful responses of sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.ok.pct<percentileValue></span></dt> + <dd>Percentile computed for successful responses of sampler name. You can input as many percentiles as you want (3 or 4 being a reasonable value).<br> + When percentile contains a comma for example "<span class="code">99.9</span>", dot is sanitized by "<span class="code">_</span>" leading to <span class="code">99_9</span>. + By default listener computes percentiles 90%, 95% and 99%</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.ko.count</span></dt> + <dd>Number of failed responses for sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.ko.min</span></dt> + <dd>Min response time for failed responses of sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.ko.max</span></dt> + <dd>Max response time for failed responses of sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.ko.pct<percentileValue></span></dt> + <dd>Percentile computed for failed responses of sampler name. You can input as many percentiles as you want (3 or 4 being a reasonable value).<br> + When percentile contains a comma for example "<span class="code">99.9</span>", dot is sanitized by "<span class="code">_</span>" leading to <span class="code">99_9</span>. + By default listener computes percentiles 90%, 95% and 99%</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.a.count</span></dt> + <dd>Number of responses for sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.a.min</span></dt> + <dd>Min response time for responses of sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.a.max</span></dt> + <dd>Max response time for responses of sampler name</dd> + <dt><span class="code"><rootMetricsPrefix>.<samplerName>.a.pct<percentileValue></span></dt> + <dd>Percentile computed for responses of sampler name. You can input as many percentiles as you want (3 or 4 being a reasonable value).<br> + When percentile contains a comma for example "<span class="code">99.9</span>", dot is sanitized by "<span class="code">_</span>" leading to <span class="code">99_9</span>. + By default listener computes percentiles 90%, 95% and 99%</dd> + </dl> <p> - By default JMeter sends only metrics for all samplers using "all" as samplerName. + By default JMeter sends only metrics for all samplers using "<span class="code">all</span>" as samplerName. </p> </div> </div> -<div class="subsection"><h2>17.2 JMeter configuration<a class="sectionlink" href="#jmeter-configuration" title="Link to here">¶</a></h2> +<div class="subsection"><h2 id="jmeter-configuration">17.2 JMeter configuration<a class="sectionlink" href="#jmeter-configuration" title="Link to here">¶</a></h2> <p> To make JMeter send metrics to backend add a <a href="./component_reference.html#Backend_Listener">BackendListener</a> using the GraphiteBackendListenerClient. </p> <figure><a href="../images/screenshots/backend_listener.png"><img src="../images/screenshots/backend_listener.png" width="902" height="341" alt="Graphite configuration"></a><figcaption>Graphite configuration</figcaption></figure> </div> -<div class="subsection"><h2>17.2 InfluxDB<a class="sectionlink" href="#influxdb" title="Link to here">¶</a></h2> +<div class="subsection"><h2 id="influxdb">17.2 InfluxDB<a class="sectionlink" href="#influxdb" title="Link to here">¶</a></h2> <p>InfluxDB is an open-source, distributed,time-series database that allows to easily store metrics. Installation and configuration is very easy, read this for more details <a href="http://influxdb.com/docs/v0.8/introduction/installation.html" target="_blank">InfluxDB documentation</a>.<br> InfluxDB data can be easily viewed in a browser through either <a href="https://github.com/hakobera/influga" target="_blank">Influga</a> or <a href="http://grafana.org/" target="_blank">Grafana</a>. We will use Grafana in this case. </p> - <div class="subsection"><h2>17.2.1 InfluxDB graphite listener configuration<a class="sectionlink" href="#influxdb_configuration" title="Link to here">¶</a></h2> - <p>To enable Graphite listener in InfluxDB, edit files /opt/influxdb/shared/config.toml or /usr/local/etc/influxdb.conf, find "input_plugins.graphite" and set this: - </p> - <span class="code"> - # Configure the graphite api<br> - [input_plugins.graphite]<br> - enabled = true<br> - address = "0.0.0.0" # If not set, is actually set to bind-address.<br> - port = 2003<br> - database = "jmeter" # store graphite data in this database<br> - # udp_enabled = true # enable udp interface on the same port as the tcp interface<br> - </span> + <div class="subsection"><h2 id="influxdb_configuration">17.2.1 InfluxDB graphite listener configuration<a class="sectionlink" href="#influxdb_configuration" title="Link to here">¶</a></h2> + <p>To enable Graphite listener in InfluxDB, edit files <span class="code">/opt/influxdb/shared/config.toml</span> or <span class="code">/usr/local/etc/influxdb.conf</span>, + find "<span class="code">input_plugins.graphite</span>" and set this: + </p> + <pre class="source"> +# Configure the graphite api +[input_plugins.graphite] +enabled = true +address = "0.0.0.0" # If not set, is actually set to bind-address. +port = 2003 +database = "jmeter" # store graphite data in this database +# udp_enabled = true # enable udp interface on the same port as the tcp interface + </pre> </div> - <div class="subsection"><h2>17.2.2 InfluxDB database configuration<a class="sectionlink" href="#influxdb_db_configuration" title="Link to here">¶</a></h2> - <p>Connect to InfluxDB admin console and create 2 databases: + <div class="subsection"><h2 id="influxdb_db_configuration">17.2.2 InfluxDB database configuration<a class="sectionlink" href="#influxdb_db_configuration" title="Link to here">¶</a></h2> + <p>Connect to InfluxDB admin console and create two databases: <ul> <li>grafana : Used by Grafana to store the dashboards we will create</li> - <li>jmeter : Used by InfluxDB to store the data sent to Graphite Listener as per database="jmeter" config element in influxdb.conf or config.toml</li> + <li>jmeter : Used by InfluxDB to store the data sent to Graphite Listener as per database="jmeter" config + element in <span class="code">influxdb.conf</span> or <span class="code">config.toml</span></li> </ul> </p> </div> - <div class="subsection"><h2>17.2.3 Grafana configuration<a class="sectionlink" href="#grafana_configuration" title="Link to here">¶</a></h2> + <div class="subsection"><h2 id="grafana_configuration">17.2.3 Grafana configuration<a class="sectionlink" href="#grafana_configuration" title="Link to here">¶</a></h2> <p> Installing grafana is just a matter of putting the unzipped bundle behind an Apache HTTP server.<br> Read <a href="http://grafana.org/docs/" targer="_blank">documentation</a> for more details. - Open config.js file and find datasources element, and edit it like this:<br> + Open <span class="code">config.js</span> file and find <span class="code">datasources</span> element, and edit it like this:<br> </p> - <span class="code"> - datasources: {<br> - influxdb: {<br> - type: 'influxdb',<br> - url: "http://localhost:8086/db/jmeter",<br> - username: 'root',<br> - password: 'root',<br> - }, - grafana: {<br> - type: 'influxdb',<br> - url: "http://localhost:8086/db/grafana",<br> - username: 'root',<br> - password: 'root',<br> - grafanaDB: true<br> - },<br> - }, - </span><br> - <p> - Note that grafana has "grafanaDB:true". Also note that here we use root user for simplicity, it is better to dedicate a special user with less rights.<br> + <pre class="source"> +datasources: { + influxdb: { + type: 'influxdb', + url: "http://localhost:8086/db/jmeter", + username: 'root', + password: 'root', + }, + grafana: { + type: 'influxdb', + url: "http://localhost:8086/db/grafana", + username: 'root', + password: 'root', + grafanaDB: true + }, +}, + </pre> + <div class="clear"></div><div class="note"> + Note that grafana has "<span class="code">grafanaDB:true</span>". Also note that here we use <span class="code">root</span> user for simplicity + It is better to dedicate a special user with less rights. + </div><div class="clear"></div> Here is the kind of dashboard that you could obtain: - </p> <figure><a href="../images/screenshots/grafana_dashboard.png"><img src="../images/screenshots/grafana_dashboard.png" width="1265" height="581" alt="Grafana dashboard"></a><figcaption>Grafana dashboard</figcaption></figure> </div> </div> -<div class="subsection"><h2>17.3 Graphite<a class="sectionlink" href="#graphite" title="Link to here">¶</a></h2> +<div class="subsection"><h2 id="graphite">17.3 Graphite<a class="sectionlink" href="#graphite" title="Link to here">¶</a></h2> <p>TODO.</p> </div> -</div><ul class="pagelinks"><li><a href="live-statistics.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="component_reference.html">Next ></a></li></ul></div><div class="footer"><div class="copyright"> +</div><ul class="pagelinks"><li><a href="remote-test.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="best-practices.html">Next ></a></li></ul></div><div class="footer"><div class="copyright"> Copyright © 1999 – - 2015 + 2016 , Apache Software Foundation </div><div class="trademarks">Apache, Apache JMeter, JMeter, the Apache feather, and the Apache JMeter logo are
Modified: jmeter/trunk/docs/usermanual/regular_expressions.html URL: http://svn.apache.org/viewvc/jmeter/trunk/docs/usermanual/regular_expressions.html?rev=1739469&r1=1739468&r2=1739469&view=diff ============================================================================== --- jmeter/trunk/docs/usermanual/regular_expressions.html (original) +++ jmeter/trunk/docs/usermanual/regular_expressions.html Sat Apr 16 14:36:00 2016 @@ -1,23 +1,12 @@ <!DOCTYPE html SYSTEM "about:legacy-compat"> <html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-15"><title>Apache JMeter - - User's Manual: Regular Expressions</title><meta name="viewport" content="width=device-width, initial-scale=1"><link href="http://fonts.googleapis.com/css?family=Merriweather:400normal" rel="stylesheet" type="text/css"><link rel="stylesheet" type="text/css" href="../css/new-style.css"></head><body role="document"><a href="#content" class="hidden">Main content</a><div class="header"><!-- + User's Manual: Regular Expressions</title><meta name="viewport" content="width=device-width, initial-scale=1"><link href="http://fonts.googleapis.com/css?family=Merriweather:400normal" rel="stylesheet" type="text/css"><link rel="stylesheet" type="text/css" href="../css/new-style.css"><link rel="apple-touch-icon-precomposed" href="../images/apple-touch-icon.png"><link rel="icon" href="../images/favicon.png"><meta name="msapplication-TileColor" content="#ffffff"><meta name="msapplication-TileImage" content="../images/mstile-144x144.png"><meta name="theme-color" content="#ffffff"></head><body role="document"><a href="#content" class="hidden">Main content</a><div class="header"><!-- APACHE LOGO - --><div><a href="http://www.apache.org"><img title="Apache Software Foundation" width="290" height="75" src="../images/asf-logo.png" alt="Logo ASF"></a></div><!-- + --><div><a href="http://www.apache.org"><img title="Apache Software Foundation" class="logo" src="../images/asf-logo.svg" alt="Logo ASF"></a></div><!-- PROJECT LOGO - --><div><a href="http://jmeter.apache.org/"><img src="../images/logo.jpg" alt="Apache JMeter"></a></div><div class="twitter"><div><a href="https://twitter.com/share" class="twitter-share-button" data-text="Powerful Load Testing with Apache #JMeter" data-via="ApacheJMeter" data-lang="en-gb" data-size="large">Tweet</a><script> - (function(d,s,id){ - var js, - fjs=d.getElementsByTagName(s)[0], - p=/^http:/.test(d.location)?'http':'https'; - if (!d.getElementById(id)) { - js=d.createElement(s); - js.id=id; - js.src=p+'://platform.twitter.com/widgets.js'; - fjs.parentNode.insertBefore(js,fjs); - } - })(document, 'script', 'twitter-wjs'); - </script></div><div><a href="https://twitter.com/ApacheJMeter" class="twitter-follow-button" data-show-count="false" data-lang="en-gb" data-size="large">Follow</a><script>(function(d,s,id){ + --><div><a href="http://jmeter.apache.org/"><img class="logo" src="../images/logo.svg" alt="Apache JMeter"></a></div><div class="banner"><iframe src="http://www.apache.org/ads/bannerbar.html" style="border-width:0;" frameborder="0" scrolling="no"></iframe><div class="clear"></div></div></div><div class="nav"><div class="social menu"><div><a href="https://twitter.com/share" class="twitter-share-button" data-text="Powerful Load Testing with Apache #JMeter" data-via="ApacheJMeter" data-lang="en-gb" data-size="large">Tweet</a><script> + (function(d,s,id){ var js, fjs=d.getElementsByTagName(s)[0], p=/^http:/.test(d.location)?'http':'https'; @@ -27,9 +16,20 @@ js.src=p+'://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js,fjs); } - })(document, 'script', 'twitter-wjs'); - </script></div></div><div class="banner"><iframe src="http://www.apache.org/ads/bannerbar.html" style="border-width:0;" frameborder="0" scrolling="no"></iframe><div class="clear"></div></div></div><div class="nav"><ul class="menu"><li><div class="menu-title">About</div><ul><li><a href="../index.html">Overview</a></li><li><a href="http://twitter.com/ApacheJMeter">JMeter on Twitter<img src="../images/twitter.png" alt="Icon for JMeter on Twitter"></a></li><li><a href="../issues.html">Issue Tracking</a></li><li><a href="http://projects.apache.org/feeds/rss/jmeter.xml">Subscribe to What's New</a></li><li><a href="http://www.apache.org/licenses/">License</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Download</div><ul><li><a href="../download_jmeter.cgi">Download Releases</a></li><li><a href="../nightly.html">Developer (Nightly) Builds</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Documentation</div><ul><li><a href="../changes.html" >Changes per version</a></li><li><a href="../usermanual/get-started.html">Get >Started</a></li><li><a href="../usermanual/index.html">User >Manual</a></li><li><a href="../usermanual/best-practices.html">Best >Practices</a></li><li><a >href="../usermanual/component_reference.html">Component >Reference</a></li><li><a href="../usermanual/functions.html">Functions >Reference</a></li><li><a href="../api/index.html">Javadocs</a></li><li><a >href="../building.html">Building JMeter and Add-Ons</a></li><li><a >href="http://wiki.apache.org/jmeter">JMeter Wiki</a></li><li><a >href="http://wiki.apache.org/jmeter/JMeterFAQ">FAQ >(Wiki)</a></li></ul></li></ul><ul class="menu"><li><div >class="menu-title">Tutorials (PDF format)</div><ul><li><a >href="../usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed >Testing</a></li><li><a >href="../usermanual/jmeter_proxy_step_by_step.pdf">Recording >Tests</a></li><li><a href="../usermanual/junitsampler_tutorial.pdf">JUnit >Sampler</a></li><li><a href="../us ermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log Sampler</a></li><li><a href="../extending/jmeter_tutorial.pdf">Extending JMeter</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Community</div><ul><li><a href="http://wiki.apache.org/jmeter/JMeterCommitters">Contributors</a></li><li><a href="../mail.html">Mailing Lists</a></li><li><a href="../svnindex.html">SVN Repositories</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Foundation</div><ul><li><a href="http://www.apache.org/">ASF</a></li><li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved in the ASF</a></li><li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></li></ul></div><div class="main" id="content"><ul class="pagelinks"><li><a href="functions.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="hints_and_tips.html"> Next ></a></li></ul><div class="section"><h1 id="regex">20. Regular Expressions<a class="sectionlink" href="#regex" title="Link to here">¶</a></h1> -<div class="subsection"><h2>20.1 Overview<a class="sectionlink" href="#overview" title="Link to here">¶</a></h2> + })(document, 'script', 'twitter-wjs'); + </script></div><div><a href="https://twitter.com/ApacheJMeter" class="twitter-follow-button" data-show-count="false" data-lang="en-gb" data-size="large">Follow</a><script>(function(d,s,id){ + var js, + fjs=d.getElementsByTagName(s)[0], + p=/^http:/.test(d.location)?'http':'https'; + if (!d.getElementById(id)) { + js=d.createElement(s); + js.id=id; + js.src=p+'://platform.twitter.com/widgets.js'; + fjs.parentNode.insertBefore(js,fjs); + } + })(document, 'script', 'twitter-wjs'); + </script></div><div><a href="https://github.com/apache/jmeter"><img alt="star this repo" src="http://githubbadges.com/star.svg?user=apache&repo=jmeter&style=default"></a></div><div><a href="https://github.com/apache/jmeter/fork"><img alt="fork this repo" src="http://githubbadges.com/fork.svg?user=apache&repo=jmeter&style=default"></a></div><div><a href="https://maven-badges.herokuapp.com/maven-central/org.apache.jmeter/ApacheJMeter"><img alt="Maven Central" src="https://maven-badges.herokuapp.com/maven-central/org.apache.jmeter/ApacheJMeter/badge.png"></a></div></div><ul class="menu"><li onClick="return true"><div class="menu-title">About</div><ul><li><a href="../index.html">Overview</a></li><li><a href="http://www.apache.org/licenses/">License</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Download</div><ul><li><a href="../download_jmeter.cgi">Download Releases</a></li><li><a href="../nightly.html">Developer (Nightly) Builds</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Documentation</div><ul><li><a href="../changes.html">Changes per version</a></li><li><a href="../usermanual/get-started.html">Get Started</a></li><li><a href="../usermanual/index.html">User Manual</a></li><li><a href="../usermanual/best-practices.html">Best Practices</a></li><li><a href="../usermanual/component_reference.html">Component Reference</a></li><li><a href="../usermanual/functions.html">Functions Reference</a></li><li><a href="../api/index.html">Javadocs</a></li><li><a href="../building.html">Building JMeter and Add-Ons</a></li><li><a href="http://wiki.apache.org/jmeter">JMeter Wiki</a></li><li><a href="http://wiki.apache.org/jmeter/JMeterFAQ">FAQ (Wiki)</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Tutorials (PDF format)</div><ul><li><a href="../usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed Testing</a ></li><li><a href="../usermanual/jmeter_proxy_step_by_step.pdf">Recording >Tests</a></li><li><a href="../usermanual/junitsampler_tutorial.pdf">JUnit >Sampler</a></li><li><a >href="../usermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log >Sampler</a></li><li><a href="../extending/jmeter_tutorial.pdf">Extending >JMeter</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div >class="menu-title">Community</div><ul><li><a href="../issues.html">Issue >Tracking</a></li><li><a href="../mail.html">Mailing Lists</a></li><li><a >href="../svnindex.html">Source Repositories</a></li><li><a >href="../building.html">Building and Contributing</a></li><li><a >href="https://projects.apache.org/project.html?jmeter">Project info at >Apache</a></li><li><a >href="http://wiki.apache.org/jmeter/JMeterCommitters">Contributors</a></li></ul></li></ul><ul > class="menu"><li onClick="return true"><div >class="menu-title">Foundation</div><ul><li><a >href="http://www.apache.org/">ASF</a></li><li><a href= "http://www.apache.org/foundation/getinvolved.html">Get Involved in the ASF</a></li><li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></li></ul></div><div class="main" id="content"><ul class="pagelinks"><li><a href="functions.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="hints_and_tips.html">Next ></a></li></ul><div class="section"><h1 id="regex">22. Regular Expressions<a class="sectionlink" href="#regex" title="Link to here">¶</a></h1> +<div class="subsection"><h2 id="overview">22.1 Overview<a class="sectionlink" href="#overview" title="Link to here">¶</a></h2> <p> JMeter includes the pattern matching software <a href="http://attic.apache.org/projects/jakarta-oro.html">Apache Jakarta ORO</a> <br> @@ -43,38 +43,40 @@ There is also documentation on an older </p> <p> The pattern matching is very similar to the pattern matching in Perl. -A full installation of Perl will include plenty of documentation on regular expressions - look for perlrequick, perlretut, perlre, perlreref. +A full installation of Perl will include plenty of documentation on regular expressions - look for <span class="code">perlrequick</span>, +<span class="code">perlretut</span>, <span class="code">perlre</span> and <span class="code">perlreref</span>. </p> <p> -It is worth stressing the difference between "contains" and "matches", as used on the Response Assertion test element: +It is worth stressing the difference between "<em>contains</em>" and "<em>matches</em>", as used on the Response Assertion test element: </p> -<ul> -<li> -"contains" means that the regular expression matched at least some part of the target, -so 'alphabet' "contains" 'ph.b.' because the regular expression matches the substring 'phabe'. -</li> -<li> -"matches" means that the regular expression matched the whole target. -So 'alphabet' is "matched" by 'al.*t'. -</li> -</ul> -<p>In this case, it is equivalent to wrapping the regular expression in ^ and $, viz '^al.*t$'. +<dl> +<dt>"<em>contains</em>"</dt><dd> means that the regular expression matched at least some part of the target, +so '<span class="code">alphabet</span>' "<em>contains</em>" '<span class="code">ph.b.</span>' because the regular expression matches the substring '<span class="code">phabe</span>'. +</dd> +<dt> +"<em>matches</em>"</dt><dd> means that the regular expression matched the whole target. +So '<span class="code">alphabet</span>' is "<em>matched</em>" by '<span class="code">al.*t</span>'. +</dd> +</dl> +<p>In this case, it is equivalent to wrapping the regular expression in <span class="code">^</span> and <span class="code">$</span>, viz '<span class="code">^al.*t$</span>'. </p> <p>However, this is not always the case. -For example, the regular expression 'alp|.lp.*' is "contained" in 'alphabet', but does not match 'alphabet'. -</p> -<p>Why? Because when the pattern matcher finds the sequence 'alp' in 'alphabet', it stops trying any other combinations - and 'alp' is not the same as 'alphabet', as it does not include 'habet'. +For example, the regular expression '<span class="code">alp|.lp.*</span>' is "<em>contained</em>" in '<span class="code">alphabet</span>', +but does not "<em>match</em>" '<span class="code">alphabet</span>'. </p> -<p> -Note: unlike Perl, there is no need to (i.e. do not) enclose the regular expression in //. +<p>Why? Because when the pattern matcher finds the sequence '<span class="code">alp</span>' in '<span class="code">alphabet</span>', it stops trying any other +combinations - and '<span class="code">alp</span>' is not the same as '<span class="code">alphabet</span>', as it does not include '<span class="code">habet</span>'. </p> +<div class="clear"></div><div class="note"> +Unlike Perl, there is no need to (i.e. do not) enclose the regular expression in <span class="code">//</span>. +</div><div class="clear"></div> <p> -So how does one use the modifiers ismx etc if there is no trailing /? -The solution is to use <i>extended regular expressions</i>, i.e. /abc/i becomes (?i)abc. +So how does one use the modifiers <span class="code">ismx</span> etc. if there is no trailing <span class="code">/</span>? +The solution is to use <i>extended regular expressions</i>, i.e. <span class="code">/abc/i</span> becomes <span class="code">(?i)abc</span>. See also <a href="#placement">Placement of modifiers</a> below. </p> </div> -<div class="subsection"><h2>20.2 Examples<a class="sectionlink" href="#examples" title="Link to here">¶</a></h2> +<div class="subsection"><h2 id="examples">22.2 Examples<a class="sectionlink" href="#examples" title="Link to here">¶</a></h2> <h3>Extract single string</h3> <p> Suppose you want to match the following portion of a web-page: @@ -89,14 +91,14 @@ A suitable regular expression would be: <p> The special characters above are: </p> -<ul> -<li>( and ) - these enclose the portion of the match string to be returned</li> -<li>. - match any character</li> -<li>+ - one or more times</li> -<li>? - don't be greedy, i.e. stop when first match succeeds</li> -</ul> +<dl> +<dt><span class="code">(</span> and <span class="code">)</span></dt><dd>these enclose the portion of the match string to be returned</dd> +<dt><span class="code">.</span></dt><dd>match any character</dd> +<dt><span class="code">+</span></dt><dd>one or more times</dd> +<dt><span class="code">?</span></dt><dd>don't be greedy, i.e. stop when first match succeeds</dd> +</dl> <p> -Note: without the ?, the .+ would continue past the first <span class="code">"></span> +Note: without the <span class="code">?</span>, the <span class="code">.+</span> would continue past the first <span class="code">"></span> until it found the last possible <span class="code">"></span> - which is probably not what was intended. </p> <p> @@ -104,7 +106,7 @@ Note: although the above expression work <br> <span class="code">name="file" value="([^"]+)"></span> where<br> -[^"] - means match anything except "<br> +<span class="code">[^"]</span> - means match anything except <span class="code">"</span><br> In this case, the matching engine can stop looking as soon as it sees the first <span class="code">"</span>, whereas in the previous case the engine has to check that it has found <span class="code">"></span> rather than say <span class="code">" ></span>. </p> @@ -114,11 +116,11 @@ Suppose you want to match the following <span class="code">name="file.name" value="readme.txt"</span> and you want to extract both <span class="code">file.name</span> and <span class="code">readme.txt</span>. <br> -A suitable reqular expression would be: +A suitable regular expression would be: <br> <span class="code">name="([^"]+)" value="([^"]+)"</span> <br> -This would create 2 groups, which could be used in the JMeter Regular Expression Extractor template as $1$ and $2$. +This would create 2 groups, which could be used in the JMeter Regular Expression Extractor template as <span class="code">$1$</span> and <span class="code">$2$</span>. </p> <p> The JMeter Regex Extractor saves the values of the groups in additional variables. @@ -127,24 +129,24 @@ The JMeter Regex Extractor saves the val For example, assume: </p> <ul> -<li>Reference Name: MYREF</li> -<li>Regex: name="(.+?)" value="(.+?)"</li> -<li>Template: $1$$2$</li> +<li>Reference Name: <span class="code">MYREF</span></li> +<li>Regex: <span class="code">name="(.+?)" value="(.+?)"</span></li> +<li>Template: <span class="code">$1$$2$</span></li> </ul> -<div class="clear"></div><div class="note">Do not enclose the regular expression in / /</div><div class="clear"></div> +<div class="clear"></div><div class="note">Do not enclose the regular expression in <span class="code">/ /</span></div><div class="clear"></div> <p> The following variables would be set: </p> -<ul> -<li>MYREF: file.namereadme.txt</li> -<li>MYREF_g0: name="file.name" value="readme.txt"</li> -<li>MYREF_g1: file.name</li> -<li>MYREF_g2: readme.txt</li> -</ul> -These variables can be referred to later on in the JMeter test plan, as ${MYREF}, ${MYREF_g1} etc +<dl> +<dt><span class="code">MYREF</span></dt><dd><span class="code">file.namereadme.txt</span></dd> +<dt><span class="code">MYREF_g0</span></dt><dd><span class="code">name="file.name" value="readme.txt"</span></dd> +<dt><span class="code">MYREF_g1</span></dt><dd><span class="code">file.name</span></dd> +<dt><span class="code">MYREF_g2</span></dt><dd><span class="code">readme.txt</span></dd> +</dl> +These variables can be referred to later on in the JMeter test plan, as <span class="code">${MYREF}</span>, <span class="code">${MYREF_g1}</span> etc. </p> </div> -<div class="subsection"><h2>20.3 Line mode<a class="sectionlink" href="#line_mode" title="Link to here">¶</a></h2> +<div class="subsection"><h2 id="line_mode">22.3 Line mode<a class="sectionlink" href="#line_mode" title="Link to here">¶</a></h2> <p>The pattern matching behaves in various slightly different ways, depending on the setting of the multi-line and single-line modifiers. Note that the single-line and multi-line operators have nothing to do with each other; @@ -152,84 +154,87 @@ they can be specified independently. </p> <h3>Single-line mode</h3> <p> -Single-line mode only affects how the '.' meta-character is interpreted. +Single-line mode only affects how the '<span class="code">.</span>' meta-character is interpreted. </p> <p> -Default behaviour is that '.' matches any character except newline. -In single-line mode, '.' also matches newline. +Default behaviour is that '<span class="code">.</span>' matches any character except newline. +In single-line mode, '<span class="code">.</span>' also matches newline. </p> <h3>Multi-line mode</h3> <p> -Multi-line mode only affects how the meta-characters '^' and '$' are interpreted. +Multi-line mode only affects how the meta-characters '<span class="code">^</span>' and '<span class="code">$</span>' are interpreted. </p> <p> -Default behaviour is that '^' and '$' only match at the very beginning and end of the string. -When Multi-line mode is used, the '^' metacharacter matches at the beginning of every line, -and the '$' metacharacter matches at the end of every line.</p> +Default behaviour is that '<span class="code">^</span>' and '<span class="code">$</span>' only match at the very beginning and end of the string. +When Multi-line mode is used, the '<span class="code">^</span>' metacharacter matches at the beginning of every line, +and the '<span class="code">$</span>' metacharacter matches at the end of every line.</p> </div> -<div class="subsection"><h2>20.4 Meta characters<a class="sectionlink" href="#meta_chars" title="Link to here">¶</a></h2> +<div class="subsection"><h2 id="meta_chars">22.4 Meta characters<a class="sectionlink" href="#meta_chars" title="Link to here">¶</a></h2> <p> Regular expressions use certain characters as meta characters - these characters have a special meaning to the RE engine. -Such characters must be escaped by preceeding them with \ (backslash) in order to treat them as ordinary characters. +Such characters must be escaped by preceding them with <span class="code">\</span> (backslash) in order to treat them as ordinary characters. Here is a list of the meta characters and their meaning (please check the ORO documentation if in doubt). </p> -<ul> -<li>( ) - grouping</li> -<li>[ ] - character classes</li> -<li>{ } - repetition</li> -<li>* + ? - repetition</li> -<li>. - wild-card character</li> -<li>\ - escape character</li> -<li>| - alternatives</li> -<li>^ $ - start and end of string or line</li> -</ul> +<dl> +<dt><span class="code">(</span> and <span class="code">)</span></dt><dd>grouping</dd> +<dt><span class="code">[</span> and <span class="code">]</span></dt><dd>character classes</dd> +<dt><span class="code">{</span> and <span class="code">}</span></dt><dd>repetition</dd> +<dt><span class="code">*</span>, <span class="code">+</span> and <span class="code">?</span></dt><dd>repetition</dd> +<dt><span class="code">.</span></dt><dd>wild-card character</dd> +<dt><span class="code">\</span></dt><dd>escape character</dd> +<dt><span class="code">|</span></dt><dd>alternatives</dd> +<dt><span class="code">^</span> and <span class="code">$</span></dt><dd>start and end of string or line</dd> +</dl> <div class="clear"></div><div class="note"> -<p>Please note that ORO does not support the \Q and \E meta-characters. +Please note that ORO does not support the <span class="code">\Q</span> and <span class="code">\E</span> meta-characters. [In other RE engines, these can be used to quote a portion of an RE so that the meta-characters stand for themselves.] You can use function to do the equivalent, see <a href="functions.html#__escapeOroRegexpChars">${__escapeOroRegexpChars(valueToEscape)}</a>. -</p> </div><div class="clear"></div> <p> The following Perl5 extended regular expressions are supported by ORO. <dl> -<dt>(?#text)</dt> +<dt><span class="code">(?#text)</span></dt> <dd>An embedded comment causing text to be ignored.</dd> -<dt>(?:regexp)</dt> -<dd>Groups things like "()" but doesn't cause the group match to be saved.</dd> -<dt>(?=regexp)</dt> -<dd>A zero-width positive lookahead assertion. For example, \w+(?=\s) matches a word followed by whitespace, without including whitespace in the MatchResult.</dd> -<dt>(?!regexp)</dt> -<dd>A zero-width negative lookahead assertion. For example foo(?!bar) matches any occurrence of "foo" that isn't followed by "bar". Remember that this is a zero-width assertion, which means that a(?!b)d will match ad because a is followed by a character that is not b (the d) and a d follows the zero-width assertion.</dd> -<dt>(?imsx)</dt> -<dd>One or more embedded pattern-match modifiers. i enables case insensitivity, m enables multiline treatment of the input, s enables single line treatment of the input, and x enables extended whitespace comments.</dd> +<dt><span class="code">(?:regexp)</span></dt> +<dd>Groups things like "<span class="code">()</span>" but doesn't cause the group match to be saved.</dd> +<dt><span class="code">(?=regexp)</span></dt> +<dd>A zero-width positive lookahead assertion. For example, <span class="code">\w+(?=\s)</span> matches a word followed by whitespace, without including whitespace in the MatchResult.</dd> +<dt><span class="code">(?!regexp)</span></dt> +<dd>A zero-width negative lookahead assertion. For example <span class="code">foo(?!bar)</span> matches any occurrence of "<span class="code">foo</span>" that +isn't followed by "<span class="code">bar</span>". Remember that this is a zero-width assertion, which means that <span class="code">a(?!b)d</span> will +match <span class="code">ad</span> because <span class="code">a</span> is followed by a character that is not <span class="code">b</span> (the <span class="code">d</span>) and a <span class="code">d</span> +follows the zero-width assertion.</dd> +<dt><span class="code">(?imsx)</span></dt> +<dd>One or more embedded pattern-match modifiers. <span class="code">i</span> enables case insensitivity, <span class="code">m</span> enables multiline treatment +of the input, <span class="code">s</span> enables single line treatment of the input, and <span class="code">x</span> enables extended whitespace comments.</dd> </dl> <b>Note that <span class="code">(?<=regexp)</span> - lookbehind - is not supported.</b> </p> </div> -<div class="subsection"><h2>20.5 Placement of modifiers<a class="sectionlink" href="#placement" title="Link to here">¶</a></h2> +<div class="subsection"><h2 id="placement">22.5 Placement of modifiers<a class="sectionlink" href="#placement" title="Link to here">¶</a></h2> <p> Modifiers can be placed anywhere in the regex, and apply from that point onwards. [A bug in ORO means that they cannot be used at the very end of the regex. However they would have no effect there anyway.] </p> <p> -The single-line (?s) and multi-line (?m) modifiers are normally placed at the start of the regex. +The single-line <span class="code">(?s)</span> and multi-line <span class="code">(?m)</span> modifiers are normally placed at the start of the regex. </p> <p> -The ignore-case modifier (?i) may be usefully applied to just part of a regex, -for example: -<pre> +The ignore-case modifier <span class="code">(?i)</span> may be usefully applied to just part of a regex, +for example:</p> +<pre class="source"> Match ExAct case or (?i)ArBiTrARY(?-i) case </pre> -</p> +would match <span class="code">Match ExAct case or arbitrary case</span> as well as <span class="code">Match ExAct case or ARBitrary case</span>, but not <span class="code">Match exact case or ArBiTrARY case</span>. </div> -</div><div class="section"><h1 id="testing_expressions">20.6 Testing Regular Expressions<a class="sectionlink" href="#testing_expressions" title="Link to here">¶</a></h1> +</div><div class="section"><h1 id="testing_expressions">22.6 Testing Regular Expressions<a class="sectionlink" href="#testing_expressions" title="Link to here">¶</a></h1> <p> Since JMeter 2.4, the listener <a href="component_reference.html#View_Results_Tree">View Results Tree</a> include a RegExp Tester to test regular expressions directly on sampler response data. @@ -246,7 +251,7 @@ without needing to access any external s </div><ul class="pagelinks"><li><a href="functions.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="hints_and_tips.html">Next ></a></li></ul></div><div class="footer"><div class="copyright"> Copyright © 1999 – - 2015 + 2016 , Apache Software Foundation </div><div class="trademarks">Apache, Apache JMeter, JMeter, the Apache feather, and the Apache JMeter logo are
