Re: [Eug-lug]Use perl to monitor webserver?

2002-12-15 Thread Bob Crandell
Luck?
No luck.
Careful planning.  ;^)

Bob Miller ([EMAIL PROTECTED]) wrote*:
>
>Bob Crandell wrote:
>
>> I put a cron job that restarted httpd about 2 or 3 AM until I had
>> time to figure out what was going on.  I figured if anyone was using
>> it then they would be so groggy they wouldn't know if it was them or
>> what.
>
>You were lucky all the site's users were in the same time zone. (-:
>
>[EMAIL PROTECTED]
>http://mailman.efn.org/cgi-bin/listinfo/eug-lug
>

--
Bob Crandell
Assured Computing
When you need to be sure.
Voice 541-689-9159
FAX   240-371-7237
[EMAIL PROTECTED]
www.assuredcomp.com
Eugene, Or. 97402


___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-15 Thread Bob Miller
Bob Crandell wrote:

> I put a cron job that restarted httpd about 2 or 3 AM until I had
> time to figure out what was going on.  I figured if anyone was using
> it then they would be so groggy they wouldn't know if it was them or
> what.

You were lucky all the site's users were in the same time zone. (-:

-- 
Bob Miller  K
kbobsoft software consulting
http://kbobsoft.com [EMAIL PROTECTED]
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-14 Thread Tim Howe
Thanks, this is something I can play with too.

TimH

On Sat, 14 Dec 2002 00:50:04 -0800
Jacob Meuser <[EMAIL PROTECTED]> wrote:

> On Fri, Dec 13, 2002 at 04:04:25PM -0800, Bob Miller wrote:
> 
> I made small changes, because he was wanting to test for a timeout,
> not any ol' error.
> 
> > #!/usr/bin/perl
> > 
> > use strict;
> > use LWP::UserAgent;
> use HTTP::Status;
> > 
> > sub check() {
> > my $ua = LWP::UserAgent->new(timeout => 5);
> > my $response = $ua->get('http://www.example.com/');
>   if ($response == RC_REQUEST_TIMEOUT) {
> > system("apachectl restart");
> > }
> > }
> > 
> > while (1) {
> > check;
> > sleep 60;
> > }
> 
> If you want to restart on any server error (you probably don't want to
> restart on client errors):
> 
>   #!/usr/bin/perl -w
> 
>   use LWP::Simple;
>   use HTTP::Status(is_server_error);
>   use strict;
> 
>   my $rc = getstore("http://localhost/index.html";, "/dev/null");
> 
>   if (is_server_error($rc)) {
>   system("apachectl stop") == 0
> or die "Could not stop httpd: $?";
> sleep 10;
>   system("apachectl start") == 0
> or die "Could not start httpd: $?";
>   }
> 
>   exit(0);
> 
> HTTP::Status is part of perl libwww.
> 
> -- 
> <[EMAIL PROTECTED]>
> 
> How does that go ... _always_ check return codes?
> ___
> Eug-LUG mailing list
> [EMAIL PROTECTED]
> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-14 Thread Jacob Meuser
On Fri, Dec 13, 2002 at 04:04:25PM -0800, Bob Miller wrote:

I made small changes, because he was wanting to test for a timeout,
not any ol' error.

>   #!/usr/bin/perl
> 
>   use strict;
>   use LWP::UserAgent;
use HTTP::Status;
> 
>   sub check() {
>   my $ua = LWP::UserAgent->new(timeout => 5);
>   my $response = $ua->get('http://www.example.com/');
if ($response == RC_REQUEST_TIMEOUT) {
>   system("apachectl restart");
>   }
>   }
> 
>   while (1) {
>   check;
>   sleep 60;
>   }

If you want to restart on any server error (you probably don't want to
restart on client errors):

#!/usr/bin/perl -w

use LWP::Simple;
use HTTP::Status(is_server_error);
use strict;

my $rc = getstore("http://localhost/index.html";, "/dev/null");

if (is_server_error($rc)) {
system("apachectl stop") == 0
or die "Could not stop httpd: $?";
sleep 10;
system("apachectl start") == 0
or die "Could not start httpd: $?";
}

exit(0);

HTTP::Status is part of perl libwww.

-- 
<[EMAIL PROTECTED]>

How does that go ... _always_ check return codes?
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Bob Crandell
Hi,

How long does it run before it stops?  How much memory are you running now?  If you
type free, how much cache is being used?

A couple of the servers I built slowed way down after running a couple days but they
didn't stop like you're describing.  I put a cron job that restarted httpd about 2
or 3 AM until I had time to figure out what was going on.  I figured if anyone was
using it then they would be so groggy they wouldn't know if it was them or what.


Tim Howe ([EMAIL PROTECTED]) wrote*:
>
>HUPing the server does not fix it.  I stop apache and then restart it.  Looking at
vmstat, fstat, and netstat don't offer much to go on.  I'm going to experiment with
a RAM upgrade and see where it takes me...
>
>TimH
>
>On Fri, 13 Dec 2002 13:23:37 -0800 (PST)
>Horst <[EMAIL PROTECTED]> wrote:
>
>> Without having the answer you may want to expand on if 'Restarting the
>> server' means rebooting or web server restart, i.e .../httpd restart.
>> Also, when web server slows down does a local 'lynx IP-of-interface'
>> behave the same?
>>  Would a frequent cron job be able to detect, e.g. huge amount of httpd
>> children, or other odd symptons,... and then call the reboot or httpd
>> restart? --there may be symptoms visible before the slowdown reaches the
>> extreme.
>>  Certainly an every 15 min cron job that calls a logging script with
>> """
>> ...
>> logFile='yourChoice'
>> echo ~~~ >> $yourChoice
>> date >> $yourChoice
>> echo ~~~ >> $yourChoice
>> pstree >> $yourChoice
>> echo ~~~ >> $yourChoice
>> ps -Afl >> $yourChoice
>> echo ~~~ >> $yourChoice
>> top -b -n 1 >> $yourChoice
>> echo ~~~ >> $yourChoice
>> ...etc
>> """
>>
>> would help with the diagnostics (but don't let it grow out of control)
>>
>>  - Horst
>>
>> On Fri, 13 Dec 2002, Tim Howe wrote:
>>
>> > I have a heavily used web server that has been deciding to simply stop serving
pages for up to 20 minutes at a time...  I have already tried all manner of Apache
and OS tweeks to stop this but nothing seems to work.  Restarting the server puts
everything back on track.  What I would like to do, until I find a real fix, is have
a Perl program try to connect to that machine on port 80, and if it fails to get a
page within, say, 5 seconds, to restart the server.
>> > I have found a bunch of modules that will ping and or connect to web servers,
but none of them seem to have a good way to time the response.  Any suggestions?
>> >
>> > TimH
>> > ___
>> > Eug-LUG mailing list
>> > [EMAIL PROTECTED]
>> > http://mailman.efn.org/cgi-bin/listinfo/eug-lug
>> >
>>
>>
>>
>>
>> ___
>> Eug-LUG mailing list
>> [EMAIL PROTECTED]
>> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
>___
>Eug-LUG mailing list
>[EMAIL PROTECTED]
>http://mailman.efn.org/cgi-bin/listinfo/eug-lug
>

--
Bob Crandell
Assured Computing
When you need to be sure.
Voice 541-689-9159
FAX   240-371-7237
[EMAIL PROTECTED]
www.assuredcomp.com
Eugene, Or. 97402


___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Tim Howe
I'm not ignoring the problem, I'm putting a bandaid on it until I figure out what is 
really wrong.  I'll play with this code.

TimH

On Fri, 13 Dec 2002 16:04:25 -0800
Bob Miller <[EMAIL PROTECTED]> wrote:

> Tim Howe wrote:
> 
> > I have a heavily used web server that has been deciding to simply
> > stop serving pages for up to 20 minutes at a time...  I have already
> > tried all manner of Apache and OS tweeks to stop this but nothing
> > seems to work.  Restarting the server puts everything back on track.
> > What I would like to do, until I find a real fix, is have a Perl
> > program try to connect to that machine on port 80, and if it fails
> > to get a page within, say, 5 seconds, to restart the server.  I have
> > found a bunch of modules that will ping and or connect to web
> > servers, but none of them seem to have a good way to time the
> > response.  Any suggestions?
> 
> First suggestion: fix the problem, not the symptom.
> 
> Second suggestion: since you're ignoring the first suggestion (-: ,
> take a look at this perl script.
> 
>   #!/usr/bin/perl
> 
>   use strict;
>   use LWP::UserAgent;
> 
>   sub check() {
>   my $ua = LWP::UserAgent->new(timeout => 5);
>   my $response = $ua->get('http://www.example.com/');
>   unless ($response->is_success) {
>   system("apachectl restart");
>   }
>   }
> 
>   while (1) {
>   check;
>   sleep 60;
>   }
> 
> 
> -- 
> Bob Miller  K
> kbobsoft software consulting
> http://kbobsoft.com [EMAIL PROTECTED]
> ___
> Eug-LUG mailing list
> [EMAIL PROTECTED]
> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Bob Miller
Tim Howe wrote:

> I have a heavily used web server that has been deciding to simply
> stop serving pages for up to 20 minutes at a time...  I have already
> tried all manner of Apache and OS tweeks to stop this but nothing
> seems to work.  Restarting the server puts everything back on track.
> What I would like to do, until I find a real fix, is have a Perl
> program try to connect to that machine on port 80, and if it fails
> to get a page within, say, 5 seconds, to restart the server.  I have
> found a bunch of modules that will ping and or connect to web
> servers, but none of them seem to have a good way to time the
> response.  Any suggestions?

First suggestion: fix the problem, not the symptom.

Second suggestion: since you're ignoring the first suggestion (-: ,
take a look at this perl script.

#!/usr/bin/perl

use strict;
use LWP::UserAgent;

sub check() {
my $ua = LWP::UserAgent->new(timeout => 5);
my $response = $ua->get('http://www.example.com/');
unless ($response->is_success) {
system("apachectl restart");
}
}

while (1) {
check;
sleep 60;
}


-- 
Bob Miller  K
kbobsoft software consulting
http://kbobsoft.com [EMAIL PROTECTED]
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Horst
Something is odd on efn -- 2 or 3 of my postings never made it (either
out
or back in), so I am resending.


Date: Fri, 13 Dec 2002 13:23:37 -0800 (PST)
To: [EMAIL PROTECTED]
Subject: Re: [Eug-lug]Use perl to monitor webserver?

Without having the answer you may want to expand on if 'Restarting the
server' means rebooting or web server restart, i.e .../httpd restart.
Also, when web server slows down does a local 'lynx IP-of-interface'
behave the same?
 Would a frequent cron job be able to detect, e.g. huge amount of httpd
children, or other odd symptons,... and then call the reboot or httpd
restart? --there may be symptoms visible before the slowdown reaches the
extreme.
 Certainly an every 15 min cron job that calls a logging script with
"""
...
logFile='yourChoice'
echo ~~~ >> $yourChoice
date >> $yourChoice
echo ~~~ >> $yourChoice
pstree >> $yourChoice
echo ~~~ >> $yourChoice
ps -Afl >> $yourChoice
echo ~~~ >> $yourChoice
top -b -n 1 >> $yourChoice
echo ~~~ >> $yourChoice
...etc
"""

would help with the diagnostics (but don't let it grow out of control)

 - Horst

Date: Fri, 13 Dec 2002 13:34:21 -0800 (PST)
To: [EMAIL PROTECTED]
Subject: Re: [Eug-lug]Use perl to monitor webserver?

...

I forgot to mention to look at the other cron jobs cron.daily, etc.
included, and start the diagnostics log a minute AFTER those. That way you
see which processes hog which resources. cron.daily can get quiet
busy. Horst

On Fri, 13 Dec 2002, Tim Howe wrote:

> I have a heavily used web server that has been deciding to simply stop serving pages 
>for up to 20 minutes at a time...  I have already tried all manner of Apache and OS 
>tweeks to stop this but nothing seems to work.  Restarting the server puts everything 
>back on track.  What I would like to do, until I find a real fix, is have a Perl 
>program try to connect to that machine on port 80, and if it fails to get a page 
>within, say, 5 seconds, to restart the server.
> I have found a bunch of modules that will ping and or connect to web servers, but 
>none of them seem to have a good way to time the response.  Any suggestions?
> 
> TimH
> ___
> Eug-LUG mailing list
> [EMAIL PROTECTED]
> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
> 



___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Cory Petkovsek
example output of line_monitor.pl from logcheck:

Unusual System Events
=-=-=-=-=-=-=-=-=-=-=
Dec 13 13:25:01 neptune line_monitor.pl: www.uoregon.edu:128.223.142.13 WWW failed

This tells me I should be more tollerant with other people webservers
before determining of my line is down (ie trying a few times like the
ping test).

Cory


On Fri, Dec 13, 2002 at 12:12:20PM -0800, Tim Howe wrote:
> I have a heavily used web server that has been deciding to simply stop serving pages 
>for up to 20 minutes at a time...  I have already tried all manner of Apache and OS 
>tweeks to stop this but nothing seems to work.  Restarting the server puts everything 
>back on track.  What I would like to do, until I find a real fix, is have a Perl 
>program try to connect to that machine on port 80, and if it fails to get a page 
>within, say, 5 seconds, to restart the server.
> I have found a bunch of modules that will ping and or connect to web servers, but 
>none of them seem to have a good way to time the response.  Any suggestions?
> 
> TimH
> ___
> Eug-LUG mailing list
> [EMAIL PROTECTED]
> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
> 
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Cory Petkovsek
Here's a perl script that I use to just determine if my lines and routers
are up.  You can easily modify it to suit your needs.  A simple system
call would restart the webserver:
system("/etc/init.d/apache stop && /etc/init.d/apache start");

I run this in /etc/cron.d every minute and dump the results in a log upon
which I run logcheck.

I think it uses a default telnet timeout of 10 seconds.  look at man
Net::Telnet to specify a timeout.  It pings some hosts, and telnets to
port 80 on some webservers.  Upon connecting to a webserver it issues,
"GET / HTTP/1.0" and expects the first line to be "HTTP/1.[01] 200 OK".
If not it prints an error.  Note that some icmp is lost, being an
unreliable protocol.  So for ping tests I try about 15 pings and if I
get at least 5 then I figure my line is up.  Eventually I'd like to have
this dialup to an isp and email-page me if my line is really down.
Right now it just emails me.

Cory


line_monitor.pl

#!/usr/bin/perl -w
#Used to monitor t1 facilities as well as local webserver

use strict;
use Net::Ping;
use Net::Telnet;

sub ping ($);
sub port_test($$);

my $hostname = `hostname`; chomp($hostname);
my $progname = `basename $0`; chomp($progname);
my $date = `date +"%b %e %T"`; chomp($date);

my %ping_hosts = (  "123.456.789.00",   "otherside_of_t1_router",  
"123.456.789.00",   "next_hop_router",  
"64.58.76.227", "www.yahoo.com",
"128.223.142.13",   "www.uoregon.edu"
);

# Use ping_hosts to determine if line is up
my $linetest=5;
for my $i (1..3) {
  foreach(keys %ping_hosts) {
$linetest-- if &ping($_);   # If can get 5 pings, line is probably up
  }
}
if($linetest>0) {
system("traceroute www.yahoo.com -n -w 2 -m 10 2>&1"); 
# traceroute to yahoo
print "$date $hostname $progname: $ping_hosts{$linetest} ICMP Failed - Line 
Down\n";
}


# Test webservers for connectivity
#my $retry = 0;
my %www_hosts = (   "192.168.0.20","local_webserver",
"128.223.142.13",   "www.uoregon.edu"
);

foreach(sort(keys %www_hosts)) {
my $r = &port_test($_, 80, "GET / HTTP/1.0\n\n");
unless ($r && $r=~m{HTTP/1.[01] 200 OK}) { 
$r="" unless $r; 
chomp($r); 
print "$date $hostname $progname: $www_hosts{$_}:$_ WWW failed
$r\n";
}
}

exit(0);


#
# Functions 
#

sub ping ($) {
my $host = $_[0];   # Host to ping

my $p = Net::Ping->new("icmp") or die "Can't create new ping object:
$!\n";

if ($p->ping ($host)) { return 1; }
else { return 0; }
$p->close();
}

sub port_test($$) {
my ($host, $port, $put) = @_;

my $t = new Net::Telnet(Host => $host, Port => $port, 
Errmode => "return", Telnetmode => 0);
return 0 unless $t;

$t->put($put) if $put;

my $line = $t->getline();
$t->close();
return $line;
}









On Fri, Dec 13, 2002 at 12:12:20PM -0800, Tim Howe wrote:
> I have a heavily used web server that has been deciding to simply stop serving pages 
>for up to 20 minutes at a time...  I have already tried all manner of Apache and OS 
>tweeks to stop this but nothing seems to work.  Restarting the server puts everything 
>back on track.  What I would like to do, until I find a real fix, is have a Perl 
>program try to connect to that machine on port 80, and if it fails to get a page 
>within, say, 5 seconds, to restart the server.
> I have found a bunch of modules that will ping and or connect to web servers, but 
>none of them seem to have a good way to time the response.  Any suggestions?
> 
> TimH
> ___
> Eug-LUG mailing list
> [EMAIL PROTECTED]
> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
> 
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Tim Howe
Now that might be a workable idea...  Thanks!

TimH

On Fri, 13 Dec 2002 14:03:31 -0800
Roger <[EMAIL PROTECTED]> wrote:

> 
> Around Fri,Dec 13 2002, at 12:12,  Tim Howe, wrote:
> >I have a heavily used web server that has been deciding to simply stop serving 
>pages for up to 20 minutes at a time...  I have already tried all manner of Apache 
>and OS tweeks to stop this but nothing seems to work.  Restarting the server puts 
>everything back on track.  What I would like to do, until I find a real fix, is have 
>a Perl program try to connect to that machine on port 80, and if it fails to get a 
>page within, say, 5 seconds, to restart the server.
> >I have found a bunch of modules that will ping and or connect to web servers, but 
>none of them seem to have a good way to time the response.  Any suggestions?
> >
> wget had a timeout function.   could you write a perl that uses uses a
> system call to wget with a timeout of say 30 seconds, if successful, do
> nothing, if unsuccessful reboot (or notify) 
> 
> -- 
> Roger
> ---
> ___
> Eug-LUG mailing list
> [EMAIL PROTECTED]
> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Roger

Around Fri,Dec 13 2002, at 12:12,  Tim Howe, wrote:
>I have a heavily used web server that has been deciding to simply stop serving pages 
>for up to 20 minutes at a time...  I have already tried all manner of Apache and OS 
>tweeks to stop this but nothing seems to work.  Restarting the server puts everything 
>back on track.  What I would like to do, until I find a real fix, is have a Perl 
>program try to connect to that machine on port 80, and if it fails to get a page 
>within, say, 5 seconds, to restart the server.
>I have found a bunch of modules that will ping and or connect to web servers, but 
>none of them seem to have a good way to time the response.  Any suggestions?
>
wget had a timeout function.   could you write a perl that uses uses a
system call to wget with a timeout of say 30 seconds, if successful, do
nothing, if unsuccessful reboot (or notify) 

-- 
Roger
---
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Tim Howe
HUPing the server does not fix it.  I stop apache and then restart it.  Looking at 
vmstat, fstat, and netstat don't offer much to go on.  I'm going to experiment with a 
RAM upgrade and see where it takes me...

TimH

On Fri, 13 Dec 2002 13:23:37 -0800 (PST)
Horst <[EMAIL PROTECTED]> wrote:

> Without having the answer you may want to expand on if 'Restarting the 
> server' means rebooting or web server restart, i.e .../httpd restart.
> Also, when web server slows down does a local 'lynx IP-of-interface'
> behave the same?
>  Would a frequent cron job be able to detect, e.g. huge amount of httpd
> children, or other odd symptons,... and then call the reboot or httpd
> restart? --there may be symptoms visible before the slowdown reaches the
> extreme.
>  Certainly an every 15 min cron job that calls a logging script with
> """
> ...
> logFile='yourChoice'
> echo ~~~ >> $yourChoice
> date >> $yourChoice
> echo ~~~ >> $yourChoice
> pstree >> $yourChoice
> echo ~~~ >> $yourChoice
> ps -Afl >> $yourChoice
> echo ~~~ >> $yourChoice
> top -b -n 1 >> $yourChoice
> echo ~~~ >> $yourChoice
> ...etc
> """
> 
> would help with the diagnostics (but don't let it grow out of control)
> 
>  - Horst
> 
> On Fri, 13 Dec 2002, Tim Howe wrote:
> 
> > I have a heavily used web server that has been deciding to simply stop serving 
>pages for up to 20 minutes at a time...  I have already tried all manner of Apache 
>and OS tweeks to stop this but nothing seems to work.  Restarting the server puts 
>everything back on track.  What I would like to do, until I find a real fix, is have 
>a Perl program try to connect to that machine on port 80, and if it fails to get a 
>page within, say, 5 seconds, to restart the server.
> > I have found a bunch of modules that will ping and or connect to web servers, but 
>none of them seem to have a good way to time the response.  Any suggestions?
> > 
> > TimH
> > ___
> > Eug-LUG mailing list
> > [EMAIL PROTECTED]
> > http://mailman.efn.org/cgi-bin/listinfo/eug-lug
> > 
> 
> 
> 
> 
> ___
> Eug-LUG mailing list
> [EMAIL PROTECTED]
> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Horst
...
>  Would a frequent cron job be able to detect, e.g. huge amount of httpd
> children, or other odd symptons,... and then call the reboot or httpd
> restart? --there may be symptoms visible before the slowdown reaches the
> extreme.
>  Certainly an every 15 min cron job that calls a logging script with
...

I forgot to mention to look at the other cron jobs cron.daily,
etc. included, and start the diagnostics a minute AFTER those. That way
you see which processes hog which resources. cron.daily can get quiet
busy. Horst


___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug



Re: [Eug-lug]Use perl to monitor webserver?

2002-12-13 Thread Horst
Without having the answer you may want to expand on if 'Restarting the 
server' means rebooting or web server restart, i.e .../httpd restart.
Also, when web server slows down does a local 'lynx IP-of-interface'
behave the same?
 Would a frequent cron job be able to detect, e.g. huge amount of httpd
children, or other odd symptons,... and then call the reboot or httpd
restart? --there may be symptoms visible before the slowdown reaches the
extreme.
 Certainly an every 15 min cron job that calls a logging script with
"""
...
logFile='yourChoice'
echo ~~~ >> $yourChoice
date >> $yourChoice
echo ~~~ >> $yourChoice
pstree >> $yourChoice
echo ~~~ >> $yourChoice
ps -Afl >> $yourChoice
echo ~~~ >> $yourChoice
top -b -n 1 >> $yourChoice
echo ~~~ >> $yourChoice
...etc
"""

would help with the diagnostics (but don't let it grow out of control)

 - Horst

On Fri, 13 Dec 2002, Tim Howe wrote:

> I have a heavily used web server that has been deciding to simply stop serving pages 
>for up to 20 minutes at a time...  I have already tried all manner of Apache and OS 
>tweeks to stop this but nothing seems to work.  Restarting the server puts everything 
>back on track.  What I would like to do, until I find a real fix, is have a Perl 
>program try to connect to that machine on port 80, and if it fails to get a page 
>within, say, 5 seconds, to restart the server.
> I have found a bunch of modules that will ping and or connect to web servers, but 
>none of them seem to have a good way to time the response.  Any suggestions?
> 
> TimH
> ___
> Eug-LUG mailing list
> [EMAIL PROTECTED]
> http://mailman.efn.org/cgi-bin/listinfo/eug-lug
> 




___
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug