2004.01_Charly's Column-Apachetop-Monitor Your Web Server.pdf

(681 KB) Pobierz
Layout 1
SYSADMIN
Charly’s Column
Apache tracking
Apachetop is to Apache what top is for processes. This tool allows admins
to monitor what the Web server is currently doing, and how much
workload that task is causing the server.
BY CHARLY KÜHNAST
W hen you need to generate an
regardless of the period in which
they occurred.
activity profile for a Web
server, you will typically
look to a traditional report generator
like Webalizer [1]. Passing an Apache
logfile to a reporting tool will generate all
kinds of useful and useless statistics.
More impatient types, such as admins
trying to track down whatever is impact-
ing their server’s performance, will be
more interested in what their Apache is
doing right now . Unfortunately, report
generators do not provide that kind of
information – Apachetop [2] to the res-
cue.
Ve rsion 0.7 appeared just as I was
writing this month’s column, and the
program’s author, Chris Elsworth, was
obviously working hard on version 0.8.
The tool is provided either as a tarball or
an RPM; installing either of these is just
as easy as launching the program itself.
Simply type
line
contains the
number of requests
that Apache has handled since you
launched Apachetop, the number of
requests per second, the total data vol-
ume transferred, and transfer volume per
second, and the average data volume
transferred per request. The lines that
then follow sort the requests by their
return values.
apachetop -H 1000 -f /path U
/Apache-Logfile
Top Typist
Just like top , Apachetop can accept run-
time commands, via simple key-presses:
• [R] sort by the number of requests
(default)
• [Shift]+[R] sort by requests/second
• [B] sort by Kbytes transferred
• [Shift]+[B] sort by Kbytes/second.
Apachetop refreshes its display every 5
seconds. If the refresh value appears to
be too frantic – and that can happen, if
you have spent the whole night hacking
– simply use the -r 20 parameter to
increase the refresh interval to 20 sec-
onds. That is a good top of the morning
value for tired admin eyes.
Punch Drunk
The next two lines are interesting for one
thing, because they can be parametrized.
The default is to display the average val-
ues for all requests in the last 30
seconds. The following syntax will
increase this period to 60 seconds:
apachetop -T 60 -f /path U
/Apache-Logfile
INFO
apachetop -f /path U
/Apache-Logfile
But be careful, setting too high an inter-
val on a heavily loaded server, will
impact the Apache monitor as it has no
time to do its sums. I tend to tell Apa-
chetop to look at the last 1000 requests,
[1] Webalizer:
http://www.mrunix.net/webalizer
[2] Apachetop:
http://clueful.shagged.org/apachetop/
to get started, and appreciate the top
look and feel (see Figure 1). The first line
is not particularly interesting, as it con-
tains only the time of the last hit, the
uptime, and the current time. The next
Charly Kühnast is a
Unix System Man-
ager at the data-
center in Moers, near
Germany’s famous
River Rhine. His tasks
include ensuring fire-
wall security and availability and
taking care of the DMZ (demilitarized
zone). Although Charly started out on
IBM mainframes, he has been working
almost exclusively with Linux since
1995. To stay in shape he tries to get in
some karate training on his leisure
time.
SYSADMIN
Big Sister ...................................... 55
Big Sister monitors your network and the
attached hosts, alerting the admin in case of
trouble.
Admin Workshop ................... 58
Providing basic email facilities is a major
challenge to admins in large-scale networks.
We take a look at email clusters.
Figure 1: Apachetop does not attempt to hide its
similarities to top
54
December 2003
www.linux-magazine.com
Apachetop
594156591.001.png 594156591.002.png
Zgłoś jeśli naruszono regulamin