Nagios::WebTransact::Timed - An object that provides a check method (usually called by a Nagios service check) to determine if a sequence of URLs can be got inside a time threshold, returning the times for each.
use Nagios::WebTransact::Timed; # Constructors $web_trx = Nagios::WebTransact::Timed->new(\@url_set);
WebTransact::Timed is a subclass of WebTransact that checks web performance by downloading a sequence of URLs.
The check is successfull if no more than fail_ratio of the URLs fail ie a URL is downloaded inside the timeout period with a successfull HTTP return code and no indications of invalid content.
Note that unlike WebTransact, this object only returns FAIL if all URLs fail or timeout.
This is the constructor for a new Nagios::WebTransact object. ref_to_array_of_hash_refs is a reference to an array of records (anon hash refs) in the format :-
ref_to_array_of_hash_refs
{ Method => HEAD|GET|POST, Url => 'http://foo/bar', Qs_fixed => [cgi_var_name_1 => val1, ... ] NB that now square brackets refer to a Perl array ref Qs_var => [cgi_var_name_1 => val_at_run_time], Exp => blah, Exp_Fault=> blurb }
Exp and Exp_Fault are normal Perl patterns without pattern match delimiters. Most often they are strings.
If these patterns contain parentheses eg 'match a lot (.*)', then the match is saved for use by Qs_var. Note that there should be only one pattern per element of the Exp list. Nested patterns ( yada(blah(.+)blurble(x|y|zz(top.*)) ) will not work as expected.
yada(blah(.+)blurble(x|y|zz(top.*))
Qs_fixed and Qs_var are used to generate a query string.
In both cases, the format of these fields is a reference to an array containing alternating CGI variable names and values eg \(name1, v1, name2, v2, ...) produces a query string name1=v1&name2=v2&..
Unless otherwise stated all methods return either a true or false value, with true meaning that the check of the web transaction was a success. false is a zero (0).
Performs a check of the Web transaction by getting the sequence or URLs specified in the constructor argument.
<OPTIONS> are passed in a hash like fashion, using key and value pairs. Possible options other than those specified by the super class are
timeout specifies a timeout different to the default (10 seconds) for each URL. When a URL cannot be fetched, it is recorded as having taken 10 (ten) seconds.
fail_ratio_percent specifies that the check will return immediately (with a failure) if the proportion of failures (ie if HTTP::Response::is_success says it is or a timeout) as a percentage, is greater than this threshold. eg if fail_ratio_percent is 100, fetching all the URls must fail before the check returns false.
verbose is meant for CLI use (or in a CGI). It reports the time taken for each URL on standard error.
download_images is meant for CLI use (or in a CGI). It reports the time taken to download each of the images found in the page provided that image has not been downloaded by the Nagios::WebTransact object session. Download time is displayed on standard error.
check returns a boolean indication of success and a reference to an array containing the time taken for each URL. If a URL cannot be download (invalid content, HTTP failure or timeout), the time is marked as 10.
see check_inter_perf.pl in t directory.
S Hopcroft, Stanley.Hopcroft@IPAustralia.Gov.AU
perl(1). Nagios::WebTransact Nagios http://www.Nagios.ORG
To install Nagios::WebTransact::Timed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nagios::WebTransact::Timed
CPAN shell
perl -MCPAN -e shell install Nagios::WebTransact::Timed
For more information on module installation, please visit the detailed CPAN module installation guide.