Monitoring Apache httpd performance with mod_status
Environment
- Red Hat Enterprise Linux (RHEL)
- Red Hat Software Collections (RHSCL)
- Red Hat JBoss Core Services (JBCS)
- Apache Web server (HTTPD)
Issue
- How can I view Apache server performance status?
- Need the configuration for Server-Status in Apache httpd server (httpd).
- How can I use mod_status?
Resolution
Apache server performance can be monitored using the Apache module mod_status. Server status is presented in an HTML page that gives the current server statistics in an easily readable form. The page can be also made automatically refresh with a compatible browser.
For active auto-refresh, where N is the time in seconds. Follow as a bellow example:
Another page gives a simple machine-readable list of the current server state.
The details given are:
- The number of children serving requests.
- The number of idle children.
- The status of each child, the number of requests that child has performed and the total number of bytes served by the child (*)
- A total number of accesses and byte count served (*).
- The time the server was started/restarted and the time it has been running for
- Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request (*).
- The current percentage CPU used by each child and in total by Apache (*).
- The current hosts and requests being processed (*).
- The current request workers are available to serve the requests.
Details marked "(*)" are only available with Content from httpd.apache.org is not included.ExtendedStatus On
How to check current request workers are available to serve the requests.
-
The less . you see, the less open slots for Apache you have available. If you see no ., this means Apache has used all its available slots.
___________________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
Activating Status Support for Apache
To activate status reports only for mydomain.comadd the following code to httpd.conf configuration file:
-
Apache httpd 2.2
<Location /server-status> SetHandler server-status Order Deny,Allow Deny from all Allow from .mydomain.com </Location> -
Apache httpd 2.4
<Location "/server-status"> SetHandler server-status Require host .mydomain.com </Location>
Note: The lines above may already exist in httpd.conf file. If this is the case, uncomment to use.
The server statistics can now be accessed through a web browser: http://mydomain.com/server-status.
If there is a possibility of an issue with Apache, consider enabling debug logging too when opening a support case
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.