in reply to Re: LWP for URL monitoring - 500 connect timeout errors
in thread LWP for URL monitoring - 500 connect timeout errors

Hi ig,

Thanks a million, that was it; now I can continue in peace. I'd done all kinds of troubleshooting, and reading up.

By the way, how is it that we can limit a proxy not to be used for local addresses, and even if we do that, how will local addresses be identified by the proxy?.

.

Really, appreciate the excellent support and patience to look into the code itself :).

.

Thanks and Regards.

  • Comment on Re^2: LWP for URL monitoring - 500 connect timeout errors

Replies are listed 'Best First'.
Re^3: LWP for URL monitoring - 500 connect timeout errors
by ig (Vicar) on Jul 20, 2009 at 07:12 UTC

    You can use the no_proxy method of LWP::UserAgent to specify hosts or domains that should not be passed to the proxy server. It takes a list of strings that are matched verbatim (i.e. the strings are not regular expressions against the host name in the URL).

    The match is anchored to the end of the host name which, if the host name is a fully qualified DNS name, allows one no_proxy string to match any hosts within that domain.

    I don't see any provision for easily excluding URLs by network (e.g. 192.168.0.0/24). You could list all the IP addresses in the network.

Re^3: LWP for URL monitoring - 500 connect timeout errors
by ig (Vicar) on Jul 20, 2009 at 07:21 UTC

    And, now that your problem is solved, I suggest you investigate some of the excellent applications available for monitoring websites and other network resources.

    Freshmeat has an article (picked lazily and somewhat dated) that lists some of the features you might think about, with links to a few of the available applications. Otherwise, search for Network Management System to find much more.

    Even if you are doing this as a learning exercise, I suggest you have a look at what existing applications do. They will give you many ideas for features to implement.

      I must say its been an enlightening experience, this thread.

      I may be treading off topic here, but your advice was really worthwhile and I would like to share what I'm looking to accomplish at the moment.

      We have OpenView Operations (OVOW) as our systems maangement tool, and I've worked previously with Network Node Manager, however it doesn't seem our comapny's too keen to go that direction just yet.

      All the services we provide are web-based applications hosted on multiple portals, so what we need here is basically an internet services monitoring and reporting application. This script is a first step in that direction and will be run as a scheduled task from OVOW and send integrated events on failure.

      Once I have this in place I'll continue searching for ways in which we can enahnce the website monitoring and reporting.

      by the way, in your opinion is this script robust enough to be used for this kind of monitoring. Is it possible to run the get command multiple times in the same script and having a correlation of three consecutive not 200 OK results to be reported as a single failure

      Looking forward to continue my learning

        I believe LWP is used quite extensively in Perl applications and that it works quite reliably. I haven't had any reliability problems myself, though my experience is somewhat limited.

        You certainly can submit multiple requests in a single invocation of the script. It should be as simple as calling the request method of the user agent multiple times with the same request.

        The following is untested, but might give you some ideas. You would have to initialize $ua, $req, $niterations, $maxerrors and $sleeptime.

        my $errorcount = 0; my @errors; for (1..$niterations) { my $res = $ua->request($req) unless($res->is_success) { $errorcount++; push(@errors, $res->status_line); } $errorcount++ unless($res->is_success); sleep($sleeptime); } die "ERRORS:\n\t" . join("\n\t", @errors) . "\n" if($errors > $maxerrors); exit(0);

        Welcome to the Monastery and good luck learning Perl.