Nagios::Plugin::WWW::Mechanize man page on Fedora

Man page or keyword search:  
man Server   31170 pages
apropos Keyword Search (all sections)
Output format
Fedora logo
[printable version]

Nagios::Plugin::WWW::MUsernContributed Perl DNagios::Plugin::WWW::Mechanize(3)

NAME
       Nagios::Plugin::WWW::Mechanize - Login to a web page as a user and get
       data as a Nagios plugin

SYNOPSIS
	 use Nagios::Plugin::WWW::Mechanize;
	 $np = Nagios::Plugin::WWW::Mechanize->new(
	   usage => "Checks number of mailing list users"
	 );
	 $np->getopts;

	 $np->get( "http://lists.opsview.org/lists/admin/opsview-users/members" );
	 $np->submit_form( form_name => "f", fields => { adminpw => "****" } );
	 $content = $np->content;
	 ($number_of_users) = ($content =~ /(\d+) members total/);
	 $np->nagios_exit( CRITICAL, "Cannot get number of users" ) unless defined $number_of_users;

	 $np->add_perfdata(
	   label => "users",
	   value => $number_of_users,
	 );
	 $np->nagios_exit(
	   OK,
	   "Number of mailing list users: $number_of_users"
	 );

DESCRIPTION
       This module ties Nagios::Plugin with WWW::Mechanize so that there's
       less code in your perl script and the most common work is done for you.

       For example, the plugin will automatically call nagios_exit(CRITICAL,
       ...) if a page is unavailable or a submit_form fails. The plugin will
       also keep a track of the time for responses from the remote web server
       and output that as performance data.

INITIALISE
       Nagios::Plugin::WWW::Mechanize->new( %opts )
	   Takes %opts. If $opts{mech} is specified and is an object, will
	   check if it is a WWW::Mechanize object and die if not.  If
	   $opts{mech} is a hash ref, will pass those to a
	   WWW::Mechanize->new() call. Will create a WWW::Mechanize object
	   with autocheck => 0, otherwise any failures are exited immediately.

	   Also looks for $opts{include_time}. Defaults to 1 which means that
	   performance data for time will be returned.

	   All other options are passed to Nagios::Plugin.

METHODS
       mech
	   Returns the WWW::Mechanize object

       get( @args )
	   Calls $self->mech->get( @args ). If $self->include_time is set,
	   will start a timer before the get, calculate the duration, and adds
	   it to a total timer.

	   If the mech->get call failed, will call nagios_exit with a CRITICAL
	   error.

	   Returns the value from mech->get.

       submit_form( @args )
	   Similar to get.

       content
	   Shortcut for $self->mech->content.

       nagios_exit
	   Override to add performance data for time if required

AUTHOR
       Ton Voon, <ton.voon@opsera.com>

COPYRIGHT AND LICENSE
       Copyright (C) 2006-2009 Opsera Limited. All rights reserved

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself, either Perl version 5.8.4 or, at
       your option, any later version of Perl 5 you may have available.

POD ERRORS
       Hey! The above document had some coding errors, which are explained
       below:

       Around line 116:
	   You forgot a '=back' before '=head1'

       Around line 188:
	   You forgot a '=back' before '=head1'

perl v5.14.1			  2009-10-27 Nagios::Plugin::WWW::Mechanize(3)
[top]

List of man pages available for Fedora

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net