Monday, March 10, 2008

Quickly test your web applications' availability

You can check out some of our other posts to find out the best practices for monitoring web sites, but this article is aimed at helping you when you've just got to test a small web app or if you just need to generate some web traffic.

If you're running a recent version of Linux, you've already got the main tool you need to automate testing of your web sites wget. This tool will access a web page that you specify and save the results into a file. The basic syntax is straightforward:

wget URL

Where the URL can be one of:

http://myserver.com
https://mysecureserver.com
ftp://myftpserver.com

And if you need to generate traffic, you can just call the command from within a loop.

Another neat feature is that you can provide POST data via a flag. Spcifically:

wget --post-data 'myvar=value+of+myvar' http://myserver.com/myapp.jsp

The key to this is knowing what post data you need to provide. To figure that out on your own, you can install either IEHttpHeaders (available from http://www.blunck.info/iehttpheaders.html) for InternetExplorer or the FireFox TamperData (http://tamperdata.mozdev.org/) extension. Just start the plugin/app and then navigate to the web page you want to automate. Once you go to the page, it will show you the POST data sent by the browser. Then just plug that into wget and you're on your way.

wget can also handle session data and has lots of other pretty neat features. Just run man wget on your Linux system to get more info.

No comments: