Things like "CPU load as a percentage of capacity and current memory usage as a percentage of available"
are more of a system thing than an apache thing. The
most generic way to gather these kinds of statistics is
with SNMP. The server will run an SNMP daemon that will
provide all sorts of performance and configuration
information to anyone sending an SNMP request (the perl
Net::SNMP module is great for polling SNMP daemons).
Though that is a very generic solution that will run well
and work well cross-platform; it does require the
instalation of an SNMP daemon on the box to be
monitored. Traditionally getting information like
you want has required some very tricky kernel IO
programming. Howerver Linux (and many other unixes)
now have a /proc filesystem that contains various
performance metrics and
kernel settings. For instance on my linux box the file
/proc/meminfo
contains the following:
total: used: free: shared: buffers: cached:
Mem: 131321856 99635200 31686656 25956352 3571712 48758784
Swap: 131567616 37847040 93720576
MemTotal: 128244 kB
MemFree: 30944 kB
MemShared: 25348 kB
Buffers: 3488 kB
Cached: 47616 kB
SwapTotal: 128484 kB
SwapFree: 91524 kB
And the file /proc/loadavg contains:
0.05 0.05 0.01 2/96 22289
These aren't "real" files, they are generated virtually by the
kernel when you read them.
You can open and read these files just like you can
any other file on your box. For more info on the /proc
filesystem and all the wonders it contains see your system
man pages.
Apache has a mod_status module that you can use to
gather performance metrics about the apache processes.
See the apache documentation for more details on its use.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|