On Thursday, November 17, 2005 4:22 PM, suppressed wrote:
Thanks for the script modifications. I think I will also reduce the timeout to 10 and the number of times it tries to 3 to try to catch the outage as soon as possible.From: suppressed [mailto:interchange-users- suppressed On Behalf Of John1 Sent: Thursday, November 17, 2005 3:12 AM On Thursday, November 17, 2005 7:02 AM, suppressed wrote:<snip>######## Snippet my $browser = LWP::UserAgent->new; $browser->timeout(30); my $count = 0; my $up = 0; while ($count <= 4) { my $response = $browser->get($url); if ($response->content =~ m/UP/) { $count = 5; $up = 1; } $count++; } ########## Ron, does this code mean that it takes your script 2.5 minutes to recognise that the server is down (i.e. 5 x 30 seconds timeout?) If so, would it be better if we reduced the timeout to about 5 seconds. Hopefully 5 tries with a 5 second timeout shouldn't cause any false alarms? That way we will spot the server going down quicker and the various system commands I have suggested inserting may then give more useful information. Perhaps we can get away with less than a 5 second timeout - what do you think? BTW, I have thise running via cron at a 1 minute interval - are you doing the same? ThanksI actually only have mine go through 3 times to check, so 90 seconds to determine if it's down, running every minute in cron. We probably could reduce the timeout value, however under a heavy load I wanted to give IC plenty of time to respond. Not sure what the ideal values would be. Another idea would be to capture the results of those commands at the beginning of the script and then email them if the site is down, that way you get the output before you know if there is a problem. Or reduce the timeout to something like 10-15 seconds, capture that output the first time you see the page is down so the data is only 1-15 seconds old. I think I'll go for the second option. Thanks, -Ron Here's the new code: my $output = ''; while ($count <= 4) { my $response = $browser->get($url); if ($response->content =~ m/UP/) { $up = 1; $count = 5; } elsif ($output == '') { $output = `$REPORT_COMMAND`; } $count++; } if ($up == 1) { } else { system $IC_COMMAND; mail_admin("IC483 restarted! $output"); print "IC483 restarted!"; }
___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
_______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.