Hi,

My first posting here - I have been trying to script something robust which could monitor websites. I've mostly used perls for pattern matching in logfiles, and for reporting purposes.

I was suggested to use LWP, and I'm still learning the ropes in this function, but I've been halted in my tracks by some " 500 connect time out" errors.

I've even set the proxy server, but with no success.

Following is the most recent version I've been using.

---------------
#!C:\perl\bin use strict; use warnings; use LWP::UserAgent; my $wsr = LWP::UserAgent -> new; $wsr -> timeout( 20 ); $wsr->proxy(['http', 'ftp','https'], 'http://192.168.5.39:8080/'); my $url = shift or die "URL expected\n"; my $useragent = LWP::UserAgent->new; my $request = HTTP::Request->new( HEAD => $url ); my $response = $useragent->request($request); print $response->status_line, "\n"; print $response->is_success, "\n";
-------------

Had some limited success but getting the timeout errors for most websites.

C:\SCRIPTING>urltestv4.pl http://www.hp.com

500 Can't connect to www.hp.com:80 (connect: timeout)

C:\SCRIPTING>urltestv4.pl http://www.hp.com:8080

500 Can't connect to www.hp.com:8080 (connect: timeout)

There doesn't seem any delay in accessing the internet from this particular server.

The following, a local site with no security restrictions, came back successfully.

C:\SCRIPTING>urltestv4.pl http://elm-as-01

200 OK

The thing is that the external websites (behind proxy) are givign time outs and not authenitcation or forbidden messages.

C:\SCRIPTING>urltestv4.pl http://www.google.com

500 Can't connect to www.google.com:80 (connect: timeout)

Lookin forward to your support

Thanks and regards,

-Alvi


In reply to LWP for URL monitoring - 500 connect timeout errors by oalvi

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.