Hi All, The is the first time I've ever looked at doing anything with Perl so bear with me..

I'm developing a system that monitors around 100 proxy servers. The proxy servers have a web page on them that displays the system status and I can't get this info out of them via SNMP.

I'm trying to replace a bash script that uses lynx to browse to the appropriate page because lynx falls over if the password is wrong. I've got the following code, which works, but when one of the proxy servers is switched off the time out period is being ignored and there is a pause of nearly 4 minutes whilst the perl script sits round doing nothing. My code is below.

It's running on Ubuntu 8.04 server (kernel is 2.6.15-26) and perl is version 5.8.7. WWW::Mechanize should be the latest version

#!/usr/bin/perl use WWW::Mechanize; use MIME::Base64; use warnings; $PASSWORD=$ARGV[1]; $IPADDRESS="HTTPS://" . $ARGV[0]; print "IP Address:$ARGV[0]\n"; print "Password:$ARGV[1]\n"; my $mech=WWW::Mechanize->new( stack_depth => 0, timeout => 10, autocheck => 0, ); #$mech->agent_alias( 'Windows IE 6' ); my @args = ( Authorization => "Basic " . MIME::Base64::encode( 'manage +r' . ':' . $PASSWORD )); $mech->get( $IPADDRESS, @args ); if ( $mech->success( ) ) { print "OK:",$mech->response->status_line(),"\n"; $EXIT_CODE=0; } else { print "Fail:",$mech->response->status_line(),"\n"; $EXIT_CODE=1; } #print $mech->content(); print "Exiting with exit code:$EXIT_CODE\n"; exit($EXIT_CODE)
Am I missing something obvious? I've done various searches and can't see what might be wrong

Cheers

Rich


In reply to WWW::Mechanize Timeout period by gutbobs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.