> How are folks checking site functionality with sites that use auth
> *other* than basic (apache) auth?
> I didn't find any plugins that support populating forms and posting.

I use a perl script and WWW:Mechanize. Here's a snippet of a check which
works on a site that stores you username as a cookie, having entered it
on a form. This check will keep that cookie, and only log in (the login
process can be very slow, but I want to know how quickly the rest of the
site is) if the cookie gets invalidated. 

I have a similar check that always logs in, without using a cookie.
Cookies are stored in /tmp/pluginname.hostname.cookies.dat

my $mech = WWW::Mechanize->new( autocheck => 1 );
my $jar = $0;
$jar =~ s/.*\///g;
$jar .= ".$HOST.cookies.dat";
$mech->cookie_jar(HTTP::Cookies->new(file => "/tmp/$jar", autosave =>
1));
foreach my $WIRE (split(/,/,$WIRES)) {
        my $url = "http://$HOST/wbmain/HHwires.aspx?Wire=$WIRE&view=2";;
        $mech->get($url);
        # If we need to log in, do so
        if ($mech->uri() =~ /loginp.aspx/) {
                $mech->form_number(1);
                $mech->field("txtname", "user.name");
                $mech->field("txtPassword", "password");
                $mech->tick("remembermachine");
                $mech->click();
                $logins++;
        }
        my $content = $mech->content;
        my $result = 0;
        foreach (split(/\n/, $content)) {
                $result++ if (/hhviewwiredetail.aspx/);
        }
        $results->{$WIRE} = $result;
}

--
Paul Weaver     
Systems Development Engineer
News Production Facilities, BBC News

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on 
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                        

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to