Monitor Apache Usage

Get Detailed Performance Information from Apache

You may be looking for a microscope into your Apache httpd service to see how many users you have using it, get performance information, and see the current individual Apache httpd processes and what they are looking at, etc…  This tool can be very useful to watch capacity and performance as well as a building block for other tools which need a source for this information.  These features are enabled by default with the mod_status module.

Configure Apache /Server-Status/

Our first task is to enable the “ExtendedStatus” option in your Apache configuration.  To do this, edit the /etc/httpd/conf/httpd.conf file.  Find the “Extended Status” option, make sure that it is no commented out and that the value is set to “On”.

ExtendedStatus On

Now, we need to configure the access to the /server-status location in your Apache configuration file.  Find the following area of your /etc/httpd/conf/httpd.conf file:

#<Location /server-status>
#    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
#</Location>

and edit it by removing the comment hashes (#) and add specific addresses or hostname domains that you want to allow to access your apache server statistics page like below:

<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from a.b.c.
Allow from x.y.z.
</Location>

Then restart the apache service:

# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd:                                    [  OK  ]

Monitor Apache Usage – Ready to Go!

You should now be set and ready to view your Apache stats in your browser.  Browse to the server status page using the proper URL:

http://uptimemadeeasy.com/server-status/

You should get a report detailing the Apache process detail, the cpu usage, and many other useful statistics that will help you manage and performance tune your Apache httpd.

Apache Server Status for uptimemadeeasy.com

Server Version: Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3
Server Built: May 13 2013 22:11:16

Current Time: Tuesday, 12-Nov-2013 11:35:51 MST
Restart Time: Tuesday, 12-Nov-2013 11:29:34 MST
Parent Server Generation: 0
Server uptime: 6 minutes 17 seconds
Total accesses: 339 – Total Traffic: 9.4 MB
CPU Usage: u5.84 s.43 cu0 cs0 – 1.66% CPU load
.899 requests/sec – 25.5 kB/second – 28.3 kB/request
1 requests currently being processed, 19 idle workers
W___________________............................................
................................................................
................................................................
................................................................

Scoreboard Key:
_” Waiting for Connection, “S” Starting up, “R” Reading Request,
W” Sending Reply, “K” Keepalive (read), “D” DNS Lookup,
C” Closing connection, “L” Logging, “G” Gracefully finishing,
I” Idle cleanup of worker, “.” Open slot with no current process

 

Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
0-0 1916 0/17/17 W 0.26 0 0 0.0 0.42 0.42 70.60.50.32 uptimemadeeasy.com GET /server-status/ HTTP/1.1
1-0 1917 0/18/18 _ 0.26 7 1 0.0 0.32 0.32 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/08/browserviewreports-200×300.jpg
2-0 1918 0/17/17 _ 1.01 8 0 0.0 0.20 0.20 70.60.50.32 uptimemadeeasy.com GET /wp-content/themes/magazine-basic/library/images/bg-hatch.g
3-0 1919 0/18/18 _ 0.68 4 76 0.0 0.46 0.46 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/09/uptimeHostNagios-200×300.png HT
4-0 1920 0/18/18 _ 0.01 8 0 0.0 0.43 0.43 70.60.50.32 uptimemadeeasy.com GET /wp-includes/images/admin-bar-sprite.png?d=20120830 HTTP/1.
5-0 1921 0/16/16 _ 0.01 7 262 0.0 0.54 0.54 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/10/clock-small.jpg HTTP/1.1
6-0 1922 0/17/17 _ 0.39 7 181 0.0 0.89 0.89 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/09/uptimeHostNagios-200×300.png HT
7-0 1923 0/18/18 _ 0.49 8 0 0.0 0.41 0.41 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/08/browserviewreports-200×300.jpg
8-0 1924 0/15/15 _ 0.01 6 2675 0.0 0.60 0.60 37.125.163.189 uptimemadeeasy.com GET /wp-content/uploads/2013/10/Connected_with_VNC.png HTTP/1.1
9-0 1925 0/18/18 _ 0.03 5 23 0.0 0.74 0.74 37.125.163.189 uptimemadeeasy.com GET /favicon.ico HTTP/1.1
10-0 1926 0/16/16 _ 0.01 7 0 0.0 0.44 0.44 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/08/Ruckus7363back-200×300.jpg HTTP
11-0 1927 0/17/17 _ 0.01 8 0 0.0 0.31 0.31 70.60.50.32 uptimemadeeasy.com GET /wp-content/themes/magazine-basic/library/images/404.png HT
12-0 1928 0/16/16 _ 2.27 7 1784 0.0 0.45 0.45 37.125.163.189 uptimemadeeasy.com GET /wp-content/themes/magazine-basic/library/images/solid.png
13-0 1929 0/17/17 _ 0.01 7 0 0.0 0.34 0.34 70.60.50.32 uptimemadeeasy.com GET /wp-content/plugins/ml-slider/assets/sliders/nivoslider/the
14-0 1930 0/17/17 _ 0.01 6 1647 0.0 1.04 1.04 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/10/Connected_with_VNC.png HTTP/1.1
15-0 1931 0/16/16 _ 0.01 8 668 0.0 0.33 0.33 37.125.163.189 uptimemadeeasy.com GET /wp-content/uploads/2013/10/clock-small.jpg HTTP/1.1
16-0 1932 0/18/18 _ 0.25 7 0 0.0 0.25 0.25 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/09/LinuxLoginsbySchedule.jpg HTTP/
17-0 1933 0/16/16 _ 0.01 7 953 0.0 0.64 0.64 70.60.50.32 uptimemadeeasy.com GET /wp-content/themes/magazine-basic/library/images/solid.png
18-0 1934 0/17/17 _ 0.53 1 0 0.0 0.30 0.30 70.60.50.32 uptimemadeeasy.com GET /wp-content/uploads/2013/10/clock-small-200×300.jpg HTTP/1.
19-0 1935 0/17/17 _ 0.01 7 0 0.0 0.26 0.26 70.60.50.32 uptimemadeeasy.com GET /wp-content/plugins/ml-slider/assets/sliders/nivoslider/the

Srv Child Server number – generation
PID OS process ID
Acc Number of accesses this connection / this child / this slot
M Mode of operation
CPU CPU usage, number of seconds
SS Seconds since beginning of most recent request
Req Milliseconds required to process most recent request
Conn Kilobytes transferred this connection
Child Megabytes transferred this child
Slot Total megabytes transferred this slot

Apache/2.2.15 (CentOS) Server at uptimemadeeasy.com Port 80
The following two tabs change content below.
Jeff has 20 years of professional IT experience, having done nearly everything in his roles of IT consultant, Systems Integrator, Systems Engineer, CNOC Engineer, Systems Administrator, Network Systems Administrator, and IT Director. If there is one thing he knows for sure, it is that there is always a simple answer to every IT problem and that downtime begins with complexity. Seasoned IT professional by day, Jeff hopes to help other IT professionals by blogging about his experiences at night on his blog: http://uptimemadeeasy.com. You can find Jeff on or LinkedIn at: LinkedIn or Twitter at: Twitter

Latest posts by Jeff Staten (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *