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

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.

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

Replies are listed 'Best First'.
Re^4: LWP for URL monitoring - 500 connect timeout errors
by Anonymous Monk on Jul 20, 2009 at 07:45 UTC

    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.