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.


In reply to Re: Perl Server Load Check? by lhoward
in thread Perl Server Load Check? by PipTigger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.