oalvi has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|