<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The BrowserMob Blog &#187; Monitoring</title>
	<atom:link href="http://blog.browsermob.com/category/monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.browsermob.com</link>
	<description>All about browsers, performance testing, and load testing</description>
	<lastBuildDate>Tue, 27 Dec 2011 17:00:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Firefox 7 support</title>
		<link>http://blog.browsermob.com/2011/11/firefox-7-support/</link>
		<comments>http://blog.browsermob.com/2011/11/firefox-7-support/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 23:19:55 +0000</pubDate>
		<dc:creator>MarkW</dc:creator>
				<category><![CDATA[Customer Feature]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Load Testing Tips]]></category>
		<category><![CDATA[Monitoring]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=1869</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
We are happy to announce that we recently added support for Firefox 7 to our monitoring and load testing products! You can now explicitly specify the Firefox version your script will run against.  Currently we support both Firefox 3.6 and Firefox 7. For example, the following script will open the Firefox 7 browser and navigate <a href='http://blog.browsermob.com/2011/11/firefox-7-support/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>We are happy to announce that we recently added support for <strong>Firefox 7 to our monitoring and load testing products</strong>!  You can now explicitly specify the Firefox version your script will run against.   Currently we support both Firefox 3.6 and Firefox 7.</p>
<p>For example, the following script will open the Firefox 7 browser and navigate to a url:</p>
<pre>var selenium = browserMob.openBrowser("FF7");
browserMob.beginTransaction();
browserMob.beginStep("Home Page");
selenium.open("http://seleniumhq.org/");
browserMob.endStep();
browserMob.endTransaction();</pre>
<p>The same is possible when using the Selenium 2.0 API (WebDriver):</p>
<pre>var webDriver = browserMob.openBrowserWebDriver("FF7");
browserMob.beginTransaction();
browserMob.beginStep("Home Page");
webDriver.get("http://seleniumhq.org/");
browserMob.endStep();
browserMob.endTransaction();</pre>
<h4>Firefox 3.6</h4>
<p><strong>Existing monitors and load tests will continue to use Firefox 3 by default</strong>.  New monitors will default to using Firefox 7, so you if you want to create a new monitor and have it run against Firefox 3.6, specify &#8220;FF3&#8243; as the browser type:</p>
<pre>var selenium = browserMob.openBrowser("FF3");</pre>
<p><span style="font-weight: bold">Future Versions</span></p>
<p>In the future, we will add support for more Firefox versions.  If you want to keep up with the latest version of Firefox installed on our systems, you will need to  specify &#8220;FF&#8221;:</p>
<pre>var selenium = browserMob.openBrowser("FF");</pre>
<p>When we upgrade to a later version of Firefox, the script will automatically use the new version.</p>
<h4>Local Validator</h4>
<p><strong>Local validator will use the Firefox version you have installed by default</strong>.  You can override the locations it looks in for the different browsers in a property file.  The file is located in your home directory on Unix and under your user folder on Windows.</p>
<p><span style="font-family: monospace">$HOME/.browserMob/config.properties</span></p>
<p>For example, if you have Firefox 7 installed in the default path and Firefox 3 under a different directory,  you can use the following <strong>config.properties</strong> to point local validator to the Firefox executables:</p>
<pre>FF3 = C:/Program Files/Mozilla Firefox 3/firefox.exe
FF7 = C:/Program Files/Mozilla Firefox/firefox.exe</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/11/firefox-7-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Repost: Website Monitoring Is Just as Important as Analyzing Traffic Data</title>
		<link>http://blog.browsermob.com/2011/10/repost-website-monitoring-is-just-as-important-as-analyzing-traffic-data/</link>
		<comments>http://blog.browsermob.com/2011/10/repost-website-monitoring-is-just-as-important-as-analyzing-traffic-data/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 12:01:38 +0000</pubDate>
		<dc:creator>Stephanie Klaiber</dc:creator>
				<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[BrowserMob]]></category>
		<category><![CDATA[Neustar]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Webmetrics]]></category>
		<category><![CDATA[website performance]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=1843</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
A LinkedIn user recently posed the question: “What are the best practices for monitoring, collecting and analyzing traffic data for a large content site?” Ian White, lead engineer at Neustar, jumped into to tell readers why active monitoring is just as important as analytics. Website monitoring ensures your site is functioning properly anytime from anywhere. <a href='http://blog.browsermob.com/2011/10/repost-website-monitoring-is-just-as-important-as-analyzing-traffic-data/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>A <a href="http://www.linkedin.com/">LinkedIn</a> user recently posed the question: “<a href="http://www.linkedin.com/answers/technology/blogging/TCH_BLG/893477-12853937?searchIdx=2&amp;sik=1315828876912&amp;goback=.asr_1_1315828876912">What are the best practices for monitoring, collecting and analyzing traffic data for a large content site?</a>” Ian White, lead engineer at <a href="http://www.neustar.biz/">Neustar</a>, jumped into to tell readers why active monitoring is just as important as analytics. <a href="http://www.webmetrics.com/monitoring-services">Website monitoring</a> ensures your site is functioning properly anytime from anywhere.</p>
<p>Below we’ve outlined a few of his key points that will help you  monitor your  site so you can sleep well at night knowing your website  is always  up and running.</p>
<p><strong>Monitor everything.</strong> You need to be alerted whenever a critical  system process goes offline. This includes web servers, cache, servers,  databases, etc. Understand that you may not know everything you should  monitor until it breaks for the first time, but that only serves as  lessons learned for additional metrics to monitor and make for a more  failsafe website over time.</p>
<p><strong>How you monitor matters.</strong> Whether the purpose of your website  is to log in a user or add an item to a shopping cart, your customers  depend on each click of the mouse to be fully functional. These  interactions require <a href="http://www.webmetrics.com/monitoring-services/overview">monitoring that automates real browser interactions</a>—like  sending headers, setting cookies or executing JavaScript—and alerts you  if something unexpected occurs. This provides a realistic view of the  customer experience.</p>
<p><strong>Monitor from multiple locations.</strong> To ensure your website is fully functional from <a href="http://www.webmetrics.com/monitoring-services/enterprise-monitoring/platform-features/globalwatch-network/">every coordinate on the globe</a>,  you need to monitor your site from different geographic locations.  There is no “magic number” for how many locations you should monitor  from, but we recommend at least three. For example, if your company is  based in the U.S., we suggest you monitor from two locations in the  States and at least one in Europe or Asia.</p>
<p><strong>Implement </strong><a href="http://www.google.com/url?sa=t&amp;rct=j&amp;q=webmetrics%20%2B%20real%20user%20monitoring&amp;source=web&amp;cd=1&amp;ved=0CDwQFjAA&amp;url=http%3A%2F%2Fwww.webmetrics.com%2Fcontent%2Fdownload%2F3952%2F59339%2Ffile%2FVisual_Application_Monitoring_Datasheet.pdf&amp;ei=pXSgTv66FNC6hAeq0LTOBA&amp;usg=AFQjCNG5_Tg8-C3NH6oEcNVTInaTYKENOQ&amp;cad=rja"><strong>Real User Monitoring (RUM)</strong></a><strong>.</strong> In addition to monitoring your website uptime, you should also test the load times for your website visitors. Similar to <a href="http://www.google.com/analytics/">Google Analytics</a>,  RUM involves placing a JavaScript beacon on your site. Every time a  user visits your site, the beacon records the load time and you are  alerted whenever this time goes above a specified threshold.</p>
<p><strong>Establish tiered alerting.</strong> If a tree falls down in a forest,  does it make a sound? The same thought process behind this popular  riddle goes into a tiered alerting system. If the individual responsible  for fixing a downtime issue doesn’t check his or her email at 3:00am  regularly, with a simple email alert system he or she will not hear  if/when your site goes offline. Services like <a href="http://www.pagerduty.com/">PagerDuty</a> ensure that alerts run up the chain of command with continual forms of  alerts until someone responds via email, text message or phone call.</p>
<p>For more information on Ian’s response or to join in on the discussion, click <a href="http://www.linkedin.com/answers/technology/blogging/TCH_BLG/893477-12853937?searchIdx=2&amp;sik=1315828876912&amp;goback=.asr_1_1315828876912">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/10/repost-website-monitoring-is-just-as-important-as-analyzing-traffic-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Keep Up With the Holiday Rush: 8 Tips for Retailers Looking to Conquer Spikes in Website Traffic</title>
		<link>http://blog.browsermob.com/2011/10/8-holiday-website-traffic-tips/</link>
		<comments>http://blog.browsermob.com/2011/10/8-holiday-website-traffic-tips/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 20:12:42 +0000</pubDate>
		<dc:creator>Stephanie Klaiber</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Load Testing]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[BrowserMob]]></category>
		<category><![CDATA[load testing best practices]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=1821</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
It’s almost that time of year again. Holiday shoppers looking to stay at arm’s length from the seasonal mall madness will undoubtedly turn to the Internet to make their gift purchases. In fact, ShopperTrak predicts national retail sales will rise 3% during November and December this year as compared to the same time period last <a href='http://blog.browsermob.com/2011/10/8-holiday-website-traffic-tips/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>It’s almost that time of year again. Holiday shoppers looking to stay at arm’s length from the seasonal mall madness will undoubtedly turn to the Internet to make their gift purchases. In fact, ShopperTrak predicts national retail sales <a href="http://www.shoppertrak.com/experts-predict-more-retail-sales-fewer-store-shoppers-holiday-season-0">will rise 3% </a>during November and December this year as compared to the same time period last year.</p>
<p>In order to keep up with this expected spike in website traffic, there are a few steps ecommerce companies should take to ready their site. In order to help, we’ve rounded up the top eight <a href="https://browsermob.com/website-load-testing">load testing</a> and <a href="https://browsermob.com/website-monitoring">website monitoring</a> tips to help ecommerce sites stay on their “A-game” this holiday season.</p>
<p><strong><em>1. Start load testing now.</em></strong> Procrastination can be a worrisome habit. Put off today what you can do tomorrow, and you may find your ecommerce site has crashed. According to IBM report, <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=3&amp;ved=0CC8QFjAC&amp;url=ftp%3A%2F%2Fftp.software.ibm.com%2Fcommon%2Fssi%2Fpm%2Fbr%2Fn%2Fsmb00305usen%2FSMB00305USEN.PDF&amp;rct=j&amp;q=IBM%20%2B%20Act%2C%20Don%27t%20React%3A%20A%20Proactive%20Business%20Continuity%20Solution%20Protects%20your%20Revenues%20and%20Reputation&amp;ei=zniLTuK7NoPbsgaO04X7AQ&amp;usg=AFQjCNHNq59hhHOq5yPlcL0op3EK8cvk0g&amp;cad=rja">Act, Don&#8217;t React: A Proactive Business Continuity Solution Protects your Revenues and Reputation</a>, the average revenue loss per hour of downtime is $1.01 million—a price tag your business cannot afford.</p>
<p><strong><em>2. Set objectives.</em></strong> Look at industry trends and establish what is “acceptable performance” for your organization. Example Key Performance Indicators (KPI’s) before load testing can include:</p>
<ul>
<li>90% of pages should load in 4 seconds or less</li>
<li>All business transactions should take less than 1 minute to complete</li>
<li>Category search should take no more than 6 seconds to complete</li>
</ul>
<p><strong><em>3. Use real browsers.</em></strong> Thanks to cloud computing, it is now cost effective to load test and monitor a website using <a href="../2011/07/repost-in-the-driver%E2%80%99s-seat-load-testing-best-practices-configuration/">real browsers</a>. Real browsers let you create more life-like site traffic, unlike virtual browsers that simply mimic a browser&#8217;s http request / response sequence. You&#8217;ll come away with a clearer view of your end user&#8217;s experience.</p>
<p><strong><em>4. Test beyond the firewall.</em></strong> The most frequently visited parts of your site are the most important to test: applications supporting your home page, browsing, product selection, checkout and exit. Without external testing, you&#8217;re only getting half the picture.</p>
<p><strong><em>5. Revisit frequency:</em></strong> Consider increasing your monitoring frequency to make sure nothing goes unnoticed. You need to be notified immediately if there is any change in your website’s behavior.</p>
<p><strong><em>6. Collaborate.</em></strong> Advertising and special promotions will affect traffic to your website. Coordinate with your marketing department to ensure your website can handle traffic upticks caused by marketing campaigns.</p>
<p><strong><em>7. Document.</em></strong> Establish a holiday preparation process and document all of your load testing and monitoring activities. That way you’ll have all the records you need to <a href="../2011/08/in-the-drivers-seat-load-testing-best-practices-analysis/">perform a post-mortem</a> and improve for next year.</p>
<p><em><strong>8. Choose the Solution that Works for Best You</strong></em><em><strong>.</strong></em> When working with load testing providers, you typically have two  choices: (a) on-demand services that let you run tests 24/7 or (b)  full-service testing, which normally includes a dedicated engineer. If  you have the resources and expertise on staff, and require greater  flexibility for when you test, on-demand is a good choice (Tip: See if  you can get started with a free trial.)  If you could use additional  expertise with testing and analysis, including professional  recommendations and reporting, then full-service load testing is the way  to go.</p>
<p>Visit http://www.browsermob.com for more information about  our  on-demand load testing solutions or  http://www.webmetrics.com for  more information on our performance monitoring and full-service load   testing solutions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/10/8-holiday-website-traffic-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BrowserMob Monitoring &#8211; Status Update on your Data Recovery</title>
		<link>http://blog.browsermob.com/2011/04/browsermob-monitoring-status-update-on-your-data-recovery/</link>
		<comments>http://blog.browsermob.com/2011/04/browsermob-monitoring-status-update-on-your-data-recovery/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 16:24:10 +0000</pubDate>
		<dc:creator>Connie</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Monitoring]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=1111</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
After a long night of reviewing the data logs and trying to recover what we lost on 04/21, we anticipate that we can recover about 9 hours of missing data during yesterday’s outage. Obviously, we were hoping to be more successful and looking to recover 100% of the data. But for now, we are able <a href='http://blog.browsermob.com/2011/04/browsermob-monitoring-status-update-on-your-data-recovery/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>After a long night of reviewing the data logs and trying to recover what we lost on 04/21, we anticipate that we can recover about 9 hours of missing data during yesterday’s outage. Obviously, we were hoping to be more successful and looking to recover 100% of the data. But for now, we are able to ascertain and recover the data lost between these time stamps:</p>
<ul>
<li>04/21/2011 at 12:47AM PT to 2:36AM PT</li>
<li>04/21/2011 at 8:36AM PT to 3:47PM PT</li>
</ul>
<p>We do know that Amazon Web Services posted a message on their status page at around  8AM PT notifying us that was a severe issue:</p>
<p><em>8:12 AM PDT Despite the continued effort from the team to resolve the issue we have not made any meaningful progress for the affected database instances since the last update. Create and Restore requests for RDS database instances are not succeeding in US-EAST-1 region.</em></p>
<p>So, here&#8217;s our next steps:</p>
<p>We will be putting resources – from engineering development to operational processes &#8211; in place to prevent this from happening again. In the next few days, we will be sifting through the recovered data and will be getting your reports and charts updated accordingly.</p>
<p>Again, we appreciate your patience!</p>
<p>Thanks and Happy Friday</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/04/browsermob-monitoring-status-update-on-your-data-recovery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>BrowserMob Monitoring is up and running!</title>
		<link>http://blog.browsermob.com/2011/04/browsermob-monitoring-is-up-and-running/</link>
		<comments>http://blog.browsermob.com/2011/04/browsermob-monitoring-is-up-and-running/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 00:40:51 +0000</pubDate>
		<dc:creator>Connie</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Monitoring]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=1106</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
We are happy to inform you that our monitoring services are now back online and our website is now stable. Here’s the latest update: Washington DC is now enabled for load tests and monitoring. Access to web service APIs is now available. Charts and reports are now accessible. However, from 1:00AM PT – 4:00PM PT <a href='http://blog.browsermob.com/2011/04/browsermob-monitoring-is-up-and-running/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>We are happy to inform you that our monitoring services are now back online and our website is now stable.</p>
<p>Here’s the latest update:</p>
<ul>
<li>Washington DC is now enabled for load tests and monitoring.</li>
<li>Access to web service APIs is now available.</li>
<li>Charts and reports are now accessible.</li>
</ul>
<p>However, from 1:00AM PT – 4:00PM PT today (04/21/2011), all reports, charts, and data relating to your monitoring services were disrupted. If you log in to your account now and view your reports or charts, you will notice a gap in your data. We want to ensure you that during this period, monitoring and alerting was not affected. You would have continued to receive downtime alerts.  In an effort to retrieve this data loss, we will be proactively sorting our raw logs and will do our best to backfill the reports and charts so it can be viewed in your account. We know that this information is imperative to your day-to-day activities, so it will be our #1 priority to get this done in the next few days.</p>
<p>We appreciate your support and patience with us today! In the meantime, if you have questions, please contact us so we can address your concerns immediately.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/04/browsermob-monitoring-is-up-and-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BrowserMob Monitoring Disruption on 04/21/2011</title>
		<link>http://blog.browsermob.com/2011/04/browsermob-monitoring-disruption-on-04212011/</link>
		<comments>http://blog.browsermob.com/2011/04/browsermob-monitoring-disruption-on-04212011/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 18:27:13 +0000</pubDate>
		<dc:creator>Connie</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Monitoring]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=1100</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
We have been experiencing a disruption in our monitoring services, due to an issue we&#8217;ve been wrestling with all morning: Amazon EC2 is having a severe service disruption. You can follow the progress here:  http://status.aws.amazon.com/. We are working through these issues in conjunction with Amazon EC2’s updates. In the meantime, here’s the latest on our <a href='http://blog.browsermob.com/2011/04/browsermob-monitoring-disruption-on-04212011/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>We have been experiencing a disruption in our monitoring services, due to an issue we&#8217;ve been wrestling with all morning: Amazon EC2 is having a severe service disruption. You can follow the progress here:  <a href="http://status.aws.amazon.com/">http://status.aws.amazon.com/</a>.</p>
<p>We are working through these issues in conjunction with Amazon EC2’s updates. In the meantime, here’s the latest on our situation:</p>
<ul>
<li>Our website has some stability issues.</li>
<li>We have disabled running load tests from Washington DC.</li>
<li>At this time, we know that some monitoring data has been lost but still limited on the scope of the loss. We will do our best to retain what we can but our primary focus is to ensure that we get downtime alerts out to you.</li>
<li>Monitoring is still continuing and alerts are still going out.</li>
<li>You can still schedule and run load tests in other regions.</li>
<li>You may have experienced validating your scripts for about a couple hours this morning.  Retry editing and saving your script, and it should validate.</li>
<li>Our web services API for monitoring data is currently offline.</li>
</ul>
<p>We will continue to update you as we know it. We sincerely apologize for the inconvenience. A monitoring system is only as good as the confidence you have in it, and do hope that you will continue to have confidence in BrowserMob monitoring as time goes on.</p>
<p>If you have concerns or questions, please feel free to contact us.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/04/browsermob-monitoring-disruption-on-04212011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selenium Tips &#8211; Wait with WaitForCondition</title>
		<link>http://blog.browsermob.com/2011/03/selenium-tips-wait-with-waitforcondition/</link>
		<comments>http://blog.browsermob.com/2011/03/selenium-tips-wait-with-waitforcondition/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 01:02:23 +0000</pubDate>
		<dc:creator>Anu Sandhanam</dc:creator>
				<category><![CDATA[FAQ]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Load Testing Tips]]></category>
		<category><![CDATA[Monitoring]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=915</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
Hello Readers, Welcome Back !! As the first part of this Selenium Tips series, this article intends to summarize the different ways to interact with dynamic sites that refresh content asynchronously wherein the script will have to wait for certain elements to appear or disappear before proceeding further. As you are already aware of, Selenium <a href='http://blog.browsermob.com/2011/03/selenium-tips-wait-with-waitforcondition/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>Hello Readers, Welcome Back !!</p>
<p>As the first part of this Selenium Tips series, this article intends to summarize the different ways to interact with dynamic sites that refresh content asynchronously wherein the script will have to wait for certain elements to appear or disappear before proceeding further.  As you are already aware of, Selenium has several ‘waitFor’ commands that fulfill this purpose. waitForCondition is one among them. ‘waitForCondition’ basically takes in two arguments, a JavaScript snippet and a timeout period in milliseconds. The snippet is executed either until it returns true or until the timeout period, after which the command will return an error. Now enough of theory and let’s get into action.</p>
<p><strong>Example:</strong><br />
<strong><i>Variation 1:</i></strong><br />
Consider the following example where there are two drop-downs, one for the states and the other for counties.<br />
The county drop-down is populated based on the state selection. </p>
<p>(<a href="http://www.bitrepository.com/apps/viewDemo/?originalPost=http://www.bitrepository.com/dynamic-dependant-dropdown-list-us-states-counties.html&amp;demoPage=http://www.bitrepository.com/demo/dynamic-dependent-dropdown-list/%22%20target=%22_blank%22%3Ehttp://www.bitrepository.com/apps/viewDemo/?originalPost=http://www.bitrepository.com/dynamic-dependant-dropdown-list-us-states-counties.html&amp;demoPage=http://www.bitrepository.com/demo/dynamic-dependent-dropdown-list/">Example</a> courtesy of bitrepository.com)</p>
<p>You can see in the site above, when the state is selected, a spinner shows up for a few seconds before the county drop-down is populated. Using waitForCondition and some JavaScript, we wait until display style attribute changes to ‘none’ in the snippet below.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://www.bitrepository.com/apps/viewDemo/?originalPost=http://www.bitrepository.com/dynamic-dependant-dropdown-list-us-states-counties.html&amp;amp;demoPage=http://www.bitrepository.com/demo/dynamic-dependent-dropdown-list/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
selenium.<span style="color: #660066;">selectFrame</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;mainFrame&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
selenium.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;state&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;label=California&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
selenium.<span style="color: #660066;">waitForCondition</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;var value = selenium.browserbot.findElementOrNull('loading_county_drop_down'); value.style.display == 'none'&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;10000&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
selenium.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;county&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;label=Amador County&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong><i>Variation 2:</i></strong><br />
You may also use logical operators to add additional logic.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">waitForCondition</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;var value = selenium.browserbot.findElementOrNull('loading_county_drop_down'); value.style.display == 'none' || selenium.browserbot.getUserWindow().document.form.county.options[0].text == 'Select a county of California';&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;10000&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong><i>Variation 3:</i></strong><br />
The same can also be accomplished by simply using waitForNotVisible and/or waitForSelectOptions.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">waitForNotVisible</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;loading_county_drop_down&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
selenium.<span style="color: #660066;">waitForSelectOptions</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;county&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;regexpi:Amador County&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>You may wonder why you need to go into the trouble of using complex JavaScript with waitForCondition while you can accomplish the same with one of the other selenium waitFor commands. The additional advantage of using waitForCondition is that you are able to declare a timeout value explicitly whereas the other waitFor commands simply honor the default selenium timeout value.</p>
<p><strong><i>Other useful variations:</i></strong><br />
You may have seen many AJAX intensive sites displaying  a ‘Loading..’ or ‘Saving..’ or ‘Processing…’ message when a button or a link is clicked. In such cases you may find this to be helpful to wait for the status text to change or disappear.</p>
<p>Assuming that a ‘Saving’ message is displayed within a div tag when a fictional ‘Save’ button is clicked in the snippet below:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">waitForCondition</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;var value = selenium.getText(<span style="color: #000099; font-weight: bold;">\&quot;</span>//div[@class='save-text']<span style="color: #000099; font-weight: bold;">\&quot;</span>);value != <span style="color: #000099; font-weight: bold;">\&quot;</span>Saving<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;20000&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In general, .Net sites that use the web form controls, panel controls etc, trigger an asynchronous postback everytime a form control is filled or a .Net tab or panel control is clicked etc. In such cases, I’ve found the following to be very helpful in waiting for the postback to complete.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">waitForCondition</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;selenium.browserbot.getUserWindow().Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack() == false;&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;10000&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now for the killer part, for sites that use jQuery, if all you need is to confirm there aren’t any active asynchronous requests, then the following does the trick:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">waitForCondition</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;selenium.browserbot.getUserWindow().$.active == 0&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;10000&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you can see, there are several possible variations to a single command. The possibilities are endless with Selenium.</p>
<p>Happy Testing !!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/03/selenium-tips-wait-with-waitforcondition/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Streamlined Error Alerts: You Spoke, We Listened</title>
		<link>http://blog.browsermob.com/2011/03/streamlined-error-alerts-you-spoke-we-listened/</link>
		<comments>http://blog.browsermob.com/2011/03/streamlined-error-alerts-you-spoke-we-listened/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 22:24:31 +0000</pubDate>
		<dc:creator>Connie</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Alerts]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=910</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
After hearing your suggestions on monitoring alerts, we&#8217;ve streamlined the number of alerts you get due to intermittent or localized problems. Before, whenever a site encountered an error condition while taking a sample, that sample may have been logged as an error or strike, causing an alert to be generated.  Now, you&#8217;ll receive an email <a href='http://blog.browsermob.com/2011/03/streamlined-error-alerts-you-spoke-we-listened/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>After hearing your suggestions on monitoring alerts, we&#8217;ve streamlined the number of alerts you get due to intermittent or localized problems. Before, whenever a site encountered an error condition while taking a sample, that sample may have been logged as an error or strike, causing an alert to be generated.  Now, you&#8217;ll receive an email alert only after we take a sample three times and still find an error. We&#8217;ll report the 1st and 2nd failures in your charts&#8211;and they&#8217;ll show up as additional checks to your normal monitoring&#8211;but we won&#8217;t clog up your inbox with extraneous alerts. Thanks much to all who provided feedback. You&#8217;ve helped us serve you more efficiently!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/03/streamlined-error-alerts-you-spoke-we-listened/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Regular Expressions and Pattern Matching with BrowserMob and Selenium</title>
		<link>http://blog.browsermob.com/2011/02/regular-expressions-and-pattern-matching-with-browsermob-and-selenium/</link>
		<comments>http://blog.browsermob.com/2011/02/regular-expressions-and-pattern-matching-with-browsermob-and-selenium/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 23:35:32 +0000</pubDate>
		<dc:creator>Anu Sandhanam</dc:creator>
				<category><![CDATA[FAQ]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Load Testing Tips]]></category>
		<category><![CDATA[Monitoring]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=872</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
Hello Readers, Welcome back!! This article intends to explain a few ways of using regular expressions with BrowserMob and Selenium. As we all know already, regular expressions are extremely helpful in scripting dynamic web sites, especially when you run into situations such as picking the first product from a dynamic list of products, clicking on <a href='http://blog.browsermob.com/2011/02/regular-expressions-and-pattern-matching-with-browsermob-and-selenium/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>Hello Readers, Welcome back!!</p>
<p>This article intends to explain a few ways of using regular expressions with BrowserMob and Selenium. As we all know already, regular expressions are extremely helpful in scripting dynamic web sites, especially when you run into situations such as picking the first product from a dynamic list of products, clicking on the last link of a dynamic drop-down etc. </p>
<p>To begin with, let&#8217;s see a couple of examples for using regular expressions with BrowserMob&#8217;s VU (Virtual User) scripts. Not sure what VU is? Check it out <a href="http://blog.browsermob.com/2008/12/faq-what-are-virtual-users/" target="_blank">here</a> or contact <a href="http://browsermob.com/website-monitoring-load-testing-support" target="_blank">BroserMob Support</a> at anytime.</p>
<p><em><strong>Example 1:</strong></em><br />
<em>Single-line Regex</em> &#8211; In this example we are trying to find a match against a piece of content spanning across a single line, which is made easy with the BrowserMob method <a href="http://static.browsermob.com/api/com/browsermob/api/BrowserMob.html#findRegexMatches(java.lang.String,%20java.lang.String)" target="_blank">findRegexMatches</a></p>
<p>In the snippet below, we are trying to parse the first item under the &#8216;News&#8217; section on yahoo.com using single-line regex.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">browserMob.<span style="color: #660066;">beginStep</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Yahoo Home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> response <span style="color: #339933;">=</span> c.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://www.yahoo.com/'</span><span style="color: #339933;">,</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// single-line regex</span>
<span style="color: #006600; font-style: italic;">// getBody() returns the body of the HTTP response</span>
<span style="color: #003366; font-weight: bold;">var</span> matches <span style="color: #339933;">=</span> browserMob.<span style="color: #660066;">findRegexMatches</span><span style="color: #009900;">&#40;</span>response.<span style="color: #660066;">getBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>small<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span>(.*?)<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// logging for troubleshooting purposes</span>
browserMob.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>matches<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066; font-weight: bold;">item</span> <span style="color: #339933;">=</span> matches<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
browserMob.<span style="color: #660066;">endStep</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
browserMob.<span style="color: #660066;">beginStep</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Follow the First News Item'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// go to the first new item parsed from the previous step</span>
<span style="color: #003366; font-weight: bold;">var</span> response <span style="color: #339933;">=</span> c.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
browserMob.<span style="color: #660066;">endStep</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><em><strong>Example 2:</strong> </em><br />
<em>Multi-line Regex</em> &#8211; In this example we are trying to find a match against a piece of content spanning across multiple lines. The Javascript &#8216;RegExp&#8217; object comes handy in this instance. </p>
<p>In the snippet below, we are trying to parse the first hyperlink from html that spans across multiple lines as indicated below. As you can see, there are few newlines separating the &#8216;ul&#8217; and &#8216;li&#8217;.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>ul <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;menu&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;/website-load-testing&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">browserMob.<span style="color: #660066;">beginStep</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'BM Home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> response <span style="color: #339933;">=</span> c.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://browsermob.com/performance-testing'</span><span style="color: #339933;">,</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// multi-line regexp</span>
<span style="color: #006600; font-style: italic;">// The regular expression uses '\s' which is any whitespace, including newline, OR \S which is anything NOT a white space</span>
<span style="color: #003366; font-weight: bold;">var</span> re <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/&lt;ul class=&quot;menu&quot;&gt;[\s|\S]*?&lt;li&gt;&amp;lt;a href=\&amp;quot;(.*?)\&amp;quot;/i</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> content <span style="color: #339933;">=</span> response.<span style="color: #660066;">getBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myArray <span style="color: #339933;">=</span> re.<span style="color: #660066;">exec</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066; font-weight: bold;">item</span> <span style="color: #339933;">=</span> myArray<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
browserMob.<span style="color: #660066;">endStep</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
browserMob.<span style="color: #660066;">beginStep</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Load Testing Home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// 'item' is the url parsed from the previous step</span>
<span style="color: #003366; font-weight: bold;">var</span> response <span style="color: #339933;">=</span> c.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://browsermob.com/'</span><span style="color: #339933;">+</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
browserMob.<span style="color: #660066;">endStep</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That was easy !! Now let&#8217;s look at a few ways of pattern matching with Selenium for <a href="http://blog.browsermob.com/2009/12/faq-whats-the-difference-between-a-real-browser-user-and-a-virtual-user/" target="_blank">BrowserMob&#8217;s RBU</a> scripts. </p>
<p>Selenium supports a few methods that help match text patterns. However, selenium locators don&#8217;t accept regular expressions. Only patterns or values accept them.</p>
<p><strong><em>Globbing:</em></strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;link=glob:*Gifts&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Clicks on any link with text suffixed with 'Gifts'</span>
selenium.<span style="color: #660066;">verifyTextPresent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;glob:*Gifts*&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><em><strong>Regular Expressions:</strong></em>[regexp, regexpi]</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;link=regexpi:^Over <span style="color: #000099; font-weight: bold;">\\</span>$[0-9]+$&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">//matches links such as 'Over $75', 'Over $85' etc</span></pre></div></div>

<p><em><strong>Contains:</strong></em></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">highlight</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;//div[contains(@class,'cnn_sectbin')]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">//highlights the first div with class attribute that contains 'cnn_sectbin'</span>
selenium.<span style="color: #660066;">highlight</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;css=div#cat_description:contains(<span style="color: #000099; font-weight: bold;">\&quot;</span>to last<span style="color: #000099; font-weight: bold;">\&quot;</span>)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">//locating a div containing the text 'to last' using css selector</span></pre></div></div>

<p><em><strong>Starts-with:</strong></em></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;//img[starts-with(@id,'cat_prod_image')]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">//clicks on the first image that has an id attribute that starts with 'cat_prod_image'</span>
selenium.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;//div[starts-with(@id,'tab_dropdown')]/a[last()]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">//clicks on the last link within the div that has a class attribute starting with 'tab_dropdown'</span>
selenium.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;//div[starts-with(@id,'tab_dropdown')]/a[position()=2]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//clicks on the second link within the div that has a class attribute starting with 'tab_dropdown'</span>
selenium.<span style="color: #660066;">highlight</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;css=div[class^='samples']&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//highlights div with class that starts with 'samples'</span></pre></div></div>

<p><em><strong>Ends-with:</strong></em></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">selenium.<span style="color: #660066;">highlight</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;css=div[class$='fabrics']&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//highlights div with class that ends with 'fabrics'</span>
selenium.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;//img[ends-with(@id,'cat_prod_image')]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//clicks on the first image that has an id attribute that ends with 'cat_prod_image'</span></pre></div></div>

<p>[<strong>Note:</strong> ends-with is supported only by Xpath 2.0. FF 3 might throw an error for this.]</p>
<p>Happy Testing !!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2011/02/regular-expressions-and-pattern-matching-with-browsermob-and-selenium/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Monitoring Maintenance Windows</title>
		<link>http://blog.browsermob.com/2010/05/monitoring-maintenance-windows/</link>
		<comments>http://blog.browsermob.com/2010/05/monitoring-maintenance-windows/#comments</comments>
		<pubDate>Mon, 17 May 2010 19:17:16 +0000</pubDate>
		<dc:creator>Ian White</dc:creator>
				<category><![CDATA[FAQ]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[downtime]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[maintenance windows]]></category>
		<category><![CDATA[RBU]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://blog.browsermob.com/?p=608</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
When setting up monitoring jobs, there are often predictable time periods in which you want to change the behavior of a script or prevent it from running at all, without having to manually stop/start the monitoring job each time. For instance, you might want to prevent errors and alert emails during routine maintenance windows, or <a href='http://blog.browsermob.com/2010/05/monitoring-maintenance-windows/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top:40%;
left:60px;
z-index:1;
background-color:#F0F4F9}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;
width:55px;
height:60px;
padding-bottom:2px;
}


#bottomcontainerBox {
float:left;
height:30px;
width:100%;
background-color:#F0F4F9}

#bottomcontainerBox .buttons {
float:left;
height:30px;
width:85px;
margin:4px 4px 4px 4px;
}

</style>
<p>When setting up monitoring jobs, there are often predictable time periods in which you want to change the behavior of a script or prevent it from running at all, without having to manually stop/start the monitoring job each time. For instance, you might want to prevent errors and alert emails during routine maintenance windows, or perhaps you&#8217;re only interested in site performance on weekdays during regular business hours. We&#8217;ve come up with solutions to a few common situations that will help jump start your scripts.</p>
<p><strong>Overview</strong><br />
At the core of all these examples is a small configuration object that sits at the top of the script for quick changes, and a single function that returns true or false depending on whether or not the current time is within a blackout period. The following is some pseudo-code outlining one way in which you might choose to implement these examples in your own scripts. Don&#8217;t forget to add in the appropriate maintenance object and isInMaintenance() function from the examples below to make this work.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// The configuration object for the maintenance window</span>
<span style="color: #003366; font-weight: bold;">var</span> maintenance <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>...<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// The maintenance function (plug in the appropriate function)</span>
<span style="color: #003366; font-weight: bold;">var</span> isInMaintenance <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    ...
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> selenium <span style="color: #339933;">=</span> browserMob.<span style="color: #660066;">openBrowser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>browserMob.<span style="color: #660066;">isValidation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> isInMaintenance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Active maintenance window</span>
    browserMob.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Is in maintenance!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Run normal script</span>
    browserMob.<span style="color: #660066;">beginTransaction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    browserMob.<span style="color: #660066;">beginStep</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Step 1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    selenium.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://google.com/search?q=website+monitoring&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ...
    <span style="color: #660066;">browserMob</span>.<span style="color: #660066;">endStep</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    browserMob.<span style="color: #660066;">endTransaction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Web Page Check</strong><br />
The most straight forward way to check for a maintenance window is to have Selenium load a web page and look for an element that&#8217;s only present during scheduled down time. You&#8217;ll want to be careful not to choose something that is also present when the site is really in trouble or you will never get your alerts!</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> maintenance <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    check<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;http://example.com/home&quot;</span><span style="color: #339933;">,</span>
        element<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;//img[@title=<span style="color: #000099; font-weight: bold;">\&quot;</span>maintenance<span style="color: #000099; font-weight: bold;">\&quot;</span>]&quot;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> isInMaintenance <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>maintenance.<span style="color: #660066;">check</span> <span style="color: #339933;">&amp;&amp;</span> maintenance.<span style="color: #660066;">check</span>.<span style="color: #660066;">url</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> maintenance.<span style="color: #660066;">check</span>.<span style="color: #660066;">element</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        selenium.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span>maintenance.<span style="color: #660066;">url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> selenium.<span style="color: #660066;">isElementPresent</span><span style="color: #009900;">&#40;</span>maintenance.<span style="color: #660066;">element</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Multipe Date Ranges</strong><br />
One of the most common requests we get is for a way to handle scheduled maintenance windows. These windows tend to be one-off date ranges decided well in advance of the actual event. Given a set of start/end dates, you could prevent monitoring errors and email alerts during the blackout periods. When setting the dates, don&#8217;t forget to include the time zone abbreviation in the argument string or the script will use the local time of the machine it&#8217;s running on.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> maintenance <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    dates<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        <span style="color: #009900;">&#123;</span>start<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;05/12/2010 23:00 PDT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> end<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;05/13/2010 02:30 PDT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#123;</span>start<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;05/24/2010 23:00 PDT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> end<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;05/25/2010 02:30 PDT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> isInMaintenance <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> now <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	    nowTime <span style="color: #339933;">=</span> now.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	    maintenanceWindows <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Check for maintenance date ranges</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>maintenance.<span style="color: #660066;">dates</span> <span style="color: #339933;">&amp;&amp;</span> maintenance.<span style="color: #660066;">dates</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        maintenanceWindows <span style="color: #339933;">=</span> maintenance.<span style="color: #660066;">dates</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> maintenanceWindows<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> maintenanceWindows<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>nowTime <span style="color: #339933;">&gt;=</span> m.<span style="color: #660066;">start</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> nowTime <span style="color: #339933;">&lt;</span> m.<span style="color: #660066;">end</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Days of the Week</strong><br />
Here&#8217;s an example for blacking out specific days of the week. This will allow you to create a script that, for example, monitors on Mondays, Wednesdays, and Fridays, or only on business days. Simply provide a time zone offset, which is the number of minutes your time zone deviates from coordinated universal time (a.k.a. UTC, GMT, Zulu time), and the days of the week you <em>don&#8217;t</em> want to run the script (from 0-6, where 0 is Sunday, 1 is Monday, etc.).</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> maintenance <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    timezoneOffset<span style="color: #339933;">:</span> <span style="color: #CC0000;">240</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// UTC offset in minutes (eg: NYC (GMT-4) is 4 * 60</span>
    days<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span>    <span style="color: #006600; font-style: italic;">// Sunday = 0, Saturday = 6</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> isInMaintenance <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> now <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        nowTime <span style="color: #339933;">=</span> now.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        timezoneOffset <span style="color: #339933;">=</span> maintenance.<span style="color: #660066;">timezoneOffset</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
        localTimezoneOffset <span style="color: #339933;">=</span> now.<span style="color: #660066;">getTimezoneOffset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        timezoneDiff <span style="color: #339933;">=</span> localTimezoneOffset <span style="color: #339933;">-</span> timezoneOffset<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Check for full blackout days (such as weekends)</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>maintenance.<span style="color: #660066;">days</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> maintenance.<span style="color: #660066;">days</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> targetDate <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>nowTime <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>timezoneDiff <span style="color: #339933;">*</span> <span style="color: #CC0000;">60</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            targetDay <span style="color: #339933;">=</span> targetDate.<span style="color: #660066;">getDay</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> maintenance.<span style="color: #660066;">days</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>maintenance.<span style="color: #660066;">days</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> targetDay<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Time of Day</strong><br />
This example shows how you can have a daily blackout range. This code will parse the start/end strings into a daily time range adjusted to the target time zone. Use this if you only want to monitor during banker&#8217;s hours, or if you want to prevent a script from running while your database is backing up.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> maintenance <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    timezoneOffset<span style="color: #339933;">:</span> <span style="color: #CC0000;">240</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// UTC offset in minutes (eg: NYC (GMT-4) is 4 * 60</span>
    hours<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>start<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;23:30&quot;</span><span style="color: #339933;">,</span> end<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;07:30&quot;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> isInMaintenance <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>startTime<span style="color: #339933;">,</span> endTime<span style="color: #339933;">,</span> offset<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> offset <span style="color: #339933;">=</span> maintenance.<span style="color: #660066;">timezoneOffset</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> now <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> nowTime <span style="color: #339933;">=</span> now.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> maintenanceWindows <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> toUtc <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>localTime<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> chunks <span style="color: #339933;">=</span> localTime.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> h <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>chunks<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>chunks<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        d.<span style="color: #660066;">setHours</span><span style="color: #009900;">&#40;</span>h<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        d.<span style="color: #660066;">setMinutes</span><span style="color: #009900;">&#40;</span>m <span style="color: #339933;">+</span> offset<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">return</span> d.<span style="color: #660066;">getHours</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;:&quot;</span> <span style="color: #339933;">+</span> d.<span style="color: #660066;">getMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> sH<span style="color: #339933;">,</span> eH<span style="color: #339933;">,</span> sM<span style="color: #339933;">,</span> eM<span style="color: #339933;">;</span>
&nbsp;
    startTime <span style="color: #339933;">=</span> toUtc<span style="color: #009900;">&#40;</span>maintenance.<span style="color: #660066;">hours</span>.<span style="color: #660066;">start</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> chunks <span style="color: #339933;">=</span> startTime.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sH <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>chunks<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sM <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>chunks<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
    endTime <span style="color: #339933;">=</span> toUtc<span style="color: #009900;">&#40;</span>maintenance.<span style="color: #660066;">hours</span>.<span style="color: #660066;">end</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    chunks <span style="color: #339933;">=</span> endTime.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    eH <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>chunks<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    eM <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>chunks<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> startDate <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>now.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> now.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> now.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> sH<span style="color: #339933;">,</span> sM<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> endDate <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>now.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> now.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> now.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> eH<span style="color: #339933;">,</span> eM<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>startDate.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> endDate.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// Single range mid-day</span>
        maintenanceWindows.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>start<span style="color: #339933;">:</span> startDate<span style="color: #339933;">,</span> end<span style="color: #339933;">:</span> endDate<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// Date wraps, which means two blackout ranges in a single day</span>
        <span style="color: #003366; font-weight: bold;">var</span> morning <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>now.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> now.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> now.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            midnight <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>morning.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #CC0000;">24</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">60</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">60</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        maintenanceWindows.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            start<span style="color: #339933;">:</span> morning<span style="color: #339933;">,</span>
            end<span style="color: #339933;">:</span> endDate
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        maintenanceWindows.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            start<span style="color: #339933;">:</span> startDate<span style="color: #339933;">,</span>
            end<span style="color: #339933;">:</span> midnight
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> maintenanceWindows<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> maintenanceWindows<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>nowTime <span style="color: #339933;">&gt;=</span> m.<span style="color: #660066;">start</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> nowTime <span style="color: #339933;">&lt;</span> m.<span style="color: #660066;">end</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now, a few of you might have noticed that the above examples are compatible with one another; you can mix-and-match them as you see fit. Just combine the various maintenance object fields into one config object, combine the contents of all the maintenance methods you want to use (just watch not to overwrite the variable declarations), and you can create something that fits just about any situation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.browsermob.com/2010/05/monitoring-maintenance-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (enhanced)

Served from: blog.browsermob.com @ 2012-02-04 02:48:51 -->
