A leaf from history: (I like "talks", old or new) Found in: http://www.modperl.com/perl_conference/cool_tricks/handout.html Author: Lincoln Stein Date: 3/15/99
Monitoring a remote server Local monitoring won't catch problems with remote machines, and they'll miss subtle problems that can happen when the Web server hangs but doesn't actually crash. A functional test is better. Script I.2.2 uses the LWP library to send a HEAD request to a bunch of servers. If any of them fails to respond, it sends out an SOS. This script does not have to run as a privileged user. ------------------------ I.2.2 ``remoteSOS'' -------------------- #!/usr/local/bin/perl # script: remoteSOS use LWP::Simple; %SERVERS = ( "Fred's server" => 'http://www.fred.com', "Martha's server" => 'http://www.stewart-living.com', "Bill's server" => 'http://www.whitehouse.gov' ); $MAIL = '/usr/sbin/sendmail'; $MAIL_FLAGS = '-t -oi'; $WEBMASTER = 'webmaster'; foreach (sort keys %SERVERS) { sos($_) unless head($SERVERS{$_}); } sub sos { my $server = shift; open (MAIL,"| $MAIL $MAIL_FLAGS") || die "mail: $!"; my $date = localtime(); print MAIL <<END; To: $WEBMASTER From: The Watchful Web Server Monitor <nobody> Subject: $server is down I tried to call $server at $date but there was no one at home. Respectfully yours, The Watchful Web Server Monitor END close MAIL; } On Jul 28, 1:03 am, [EMAIL PROTECTED] (Ravi Malghan) wrote: > Hi: I am looking to build a script that can go to a webpage, login with a > username/password, download a page, perform a checksum comparison. Two things > I am trying to accomplish. > > 1. Is the website is up > 2. Has the website been compromised. > > I found a number of pointers when I googled some strings. Wondering if > someone has implemented this or have ideas on how best to approach this. > > Thanks > Ray > > ____________________________________________________________________________________ > Need a vacation? Get great deals > to amazing places on Yahoo! Travel.http://travel.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/