[RndTbl] Tips for isolating causes of system load
Sean A. Walberg
sean at ertw.com
Sat Feb 12 18:05:23 CST 2005
The quick fix to the multiple calls to fullstatus would be to create a
temporary file:
T=`/bin/mktemp /tmp/apache.XXXXXXXX` || exit 1
apachectl fullstatus > $T
...
/bin/rm $T
Sean
On Sat, 12 Feb 2005, John Lange wrote:
> Thanks Sean.
>
> Based on that tip (I hadn't realized that "apachectl fullstatus" outputs
> to stdout) I have come up with just about the ugliest bash script every
> written! But it works...
>
> This takes the top 5 most CPU intensive processes and looks for the ones
> owned by the "www" user. It then re-greps for that process id so it can
> spit out the entire line from "ps". Then it also greps "apachectrl
> fullstatus" for the same PID so we can see what that process is actually
> doing.
>
> If this doesn't make you bash scripters out there cringe I don't think
> anything will... ;)
>
> ---
> for PID in `ps -weo pid,%cpu,user,args --sort %cpu |tail -n5|grep
> www|cut -f1 -d " "`; do ps -weo pid,%cpu,user,args --sort %cpu |grep -v
> grep|grep $PID ; apachectl fullstatus |grep -A1 $PID; done
> ---
>
> The obvious problems with this are:
>
> - It invokes way to many processes (some of them more than once)
> - loops through "fullstatus" every time.
>
> The only other problem is that lynx truncates the longer request lines
> at 80 columns so you are missing part of what the client is requesting
> that is causing the load.
>
> If anyone has some suggestions for how to clean that up please feel free
> to suggest them.
>
> I'm actually a bit dismayed that Apache doesn't have better command line
> tools for querying the status of the server.
>
> John
>
> On Sat, 2005-02-12 at 13:47, Sean Cody wrote:
> > > Anyone have any suggestions for a little bash script that could do this
> > > auto-magically?
> >
> > 'apachectl fullstatus' seems to work alright for me. Not immediately
> > as intuitive but it does work.
>
>
> _______________________________________________
> Roundtable mailing list
> Roundtable at muug.mb.ca
> http://www.muug.mb.ca/mailman/listinfo/roundtable
>
--
Sean A. Walberg <sean at ertw.com> http://www.ertw.com
More information about the Roundtable
mailing list