In the same vein as the previous article, here’s an interesting discovery I made regarding performance monitoring of Apache.
We’re doing fairly heavy traffic at the moment, over 200 reqs/sec to a single webserver runing PHP/MySQL. Running Apache’s status module gives some good interactive feedback regarding process/child/slot status, busy threads, CPU usage, etc., all summarised at http://example.com/server-status.
For an idea of the output check out the status pages of the Apache or PHP sites. Although this kind of feedback is invaluable, more useful still would be something that keeps a record of this data over time.
Enter the Apache.mrtg project.
All that’s involved in getting the stats is running a cronjob which fires off MRTG which reads a config file that takes input from a Perl file. The Perl file gets its input from any website’s server-status output, given you call it in the form
Here are some example of the output:
The cronjob I used looks something like this:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * env LANG=C /path/to/mrtg /path/to/apache.mrtg.cfg