PagePoker is a Perl package that defines a browser agent with many powerful features for monitoring and testing Web sites, including elaborate failure handling that can send email and trigger SNMP traps. The application comes with three scripts that implement it for different uses: poke.pl, for single agents; pokes.pl, for many parallel agents, and pokehard.pl, for loadtesting and benchmarking.

HOW-TO:

Run "poke.pl --help" for detailed help on using the package. Briefly, poke.pl creates a PagePoker object, accepting all sorts of options. It is designed for monitoring web pages to verify they are returning desired information or to dump the contents of web pages to a file (like fetch). It can loop on a variety of conditions and crawl a series of pages, posting and passing cookies. The other component, pokes.pl, is simply a forking variation that accepts as its parameters an agent id and the options for that agent. It can be used for monitoring many sites simultaneously or for load testing single sites. On a dual 400 mhz machine I was able to run about 120 concurrent agents.

will launch two agents, first agent will poll node.to for connection failures every 10 seconds 1000 times, emailing if a failure is encountered, second agent will hit node.to then tiny.node.to and exit, emailing two people if either one doesn't respond.

There is a lot of logic to control how often and under what conditions email is sent. You can search for desired in text the headers or the html response, and send email or snmp traps on certain failure conditions. To loadtest, you could launch looping batches of ten agents, adding ten more a minute later in a another process, etc.

More advanced load testing can be done with pokehard.pl. It gets its own README (README.pokehard).

Here is the output of poke.pl --help, minus the USAGE statement:

How to use it:

--url "http://host/page"

--urls "http://host/page1>>http://host/page2>>etc"

--urls-from-file "file_path"

--urls-delay "n" Seconds between each request

--method {GET|POST}

--post-query "query string"

--basic-auth-name "agent login" (one per agent)

--basic-auth-pass "agent password"

--interval "n" Loop with n seconds between pokes

--iterations "n" Cycles to run loop (requires --interval)

--look-for "pattern to find in response text"

--resend-cookie "cookiename"

--resend-cookie-between-iterations Allow cookie to be resent through all iterations