[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] CPU Heavily Loaded
- Subject: Re: [cobalt-users] CPU Heavily Loaded
- From: Gerald Young <me@xxxxxxxxxxx>
- Date: Thu Aug 23 08:04:54 2001
- Organization: Coolcat Dot Net ltd
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
> Does anyone have a script like this handy?
hi i had the same problem and am running the below script (cant remember where
i got it)
it logs to a file in the same directory called 'loadstat'
seems to work a treat then i check the ip address against my access file as
cat /var/log/httpd/access | grep 1111.1111.1111 > highiplog
this extracts the ip 1111.111.1111.111 to a file called highiplog
sort of messy but has allowed me to find the cgi that are high load
my top line
`top -n 2 >>topout`;
isent working will have a look not perfect yes a shell script that grabbed the
processes with a high load would be better but this did the trick for me.b w
Gerald y
#!/usr/bin/perl
# check lode above 1 say
my $load = 1;
my $trace = "/bin/netstat -natu | grep -E \"(ESTABLISHED|TIME_WAIT|CLOSE_WAIT)\"";
my $log = "loadstat"; while(1) {
$_ = `cat /proc/loadavg`;
/(\d+)\.(\d\d)\s.*/;
if($1 >= $load) {
## do top stuff
`top -n 2 >>topout`;
open(FH, ">>$log") || die "Cannot open log file $log: $!\n";
my $time = localtime();
my $info = `$trace`;
print FH $time, " load $1.$2\n", $info;
close(FH);
}
sleep(60);
}
#############################################################################
>
> Thinking on this, you could probably write a little shell script that
> logged the output of top to a file every 5 minutes or so, which would
> give you a nice little snapshot that you could refer back to.
> HTH!
> --
> CarrieB
> "This year will go down in history. For the first time, a civilized
> nation has full gun registration! Our streets will be safer, our
> police more efficient, and the world will follow our lead into the
> future." --Adolf Hitler, 1935
>
>
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> To Subscribe or Unsubscribe, please go to:
> http://list.cobalt.com/mailman/listinfo/cobalt-users
--
Gerald Young www.coolcat.net
www.coolcoach.net - THE HOTTEST WAY TO LEARN -
-------------------------------------------------------------
Localhost: 9:01am up 6 days, 22:50, 3 users, load average: 0.00, 0.00, 0.00
Word .doc's not accepted and automatically deleted