8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
Apache Monitoring using mod_status (server-status)
The mod_status
Apache module provides out-of-the-box functionality for monitoring the performance of Apache installations.
Related articles.
- Linux HTTP and FTP Server Configuration (RHCSA)
- Linux HTTP Server Configuration (RHCE)
- Apache : Reverse Proxy Configuration
Setup
The mod_status
Apache module should be loaded by default in any modern version of Apache. You can see this by checking for the following line in the "/etc/httpd/conf/httpd.conf" file.
LoadModule status_module modules/mod_status.so
Assuming that is in place already, you just need to enable to "server-status" page by making two amendments to the "/etc/httpd/conf/httpd.conf".
If you want additional status information, you can set the ExtendedStatus
option to "On". The default is "Off".
ExtendedStatus On
Uncomment the "server-status" location, amending the "Allow from" line to include any domains or IP addresses that you want to have access to the status page. It is a good idea to lock this down as much as possible.
<Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from localhost 192.168.0.4 </Location>
Reload or restart Apache.
# service httpd reload # # OR # service httpd restart
The server status page should now be visible from the following type of URL. The "refresh=15" parameter means the page will refresh every 15 seconds.
http://localhost/server-status http://localhost/server-status?refresh=15
Reading the server-status Page
The status page is made up of several distinct sections. The header contains basic information about the Apache installation.
Apache Server Status for localhost Server Version: Apache/2.2.15 (Unix) DAV/2 Server Built: Aug 13 2013 10:51:17
There is a status summary containing basic status information.
Current Time: Tuesday, 18-Mar-2014 10:12:23 GMT Restart Time: Tuesday, 18-Mar-2014 10:08:10 GMT Parent Server Generation: 0 Server uptime: 4 minutes 13 seconds Total accesses: 6 - Total Traffic: 19 kB CPU Usage: u0 s0 cu0 cs0 .0237 requests/sec - 76 B/second - 3242 B/request 1 requests currently being processed, 7 idle workers
The scoreboard gives a visual display of how the available slots are being used.
_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
We have 8 servers spawned, with 7 of them idle (_). In total, there are 256 slots. If we look at the configuration in the "httpd.conf" file, we can see this is what we should expect.
<IfModule prefork.c> StartServers 8 MinSpareServers 5 MaxSpareServers 20 ServerLimit 256 MaxClients 256 MaxRequestsPerChild 4000 </IfModule>
The bottom of the status page contains information about current requests.
Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request 0-0 31705 0/13/13 W 0.00 0 0 0.0 0.05 0.05 ::1 ol6-mysql.localdomain GET /server-status?refresh=15 HTTP/1.1 1-0 31706 0/13/13 _ 0.00 75 0 0.0 0.05 0.05 localhost ol6-mysql.localdomain GET /server-status?refresh=15 HTTP/1.1 2-0 31707 0/13/13 _ 0.00 105 0 0.0 0.05 0.05 localhost ol6-mysql.localdomain GET /server-status?refresh=15 HTTP/1.1 3-0 31708 0/13/13 _ 0.00 90 0 0.0 0.05 0.05 localhost ol6-mysql.localdomain GET /server-status?refresh=15 HTTP/1.1 4-0 31709 0/13/13 _ 0.00 60 0 0.0 0.05 0.05 localhost ol6-mysql.localdomain GET /server-status?refresh=15 HTTP/1.1 5-0 31710 0/13/13 _ 0.00 45 0 0.0 0.06 0.06 localhost ol6-mysql.localdomain GET /server-status?refresh=15 HTTP/1.1 6-0 31711 0/13/13 _ 0.00 30 1 0.0 0.06 0.06 localhost ol6-mysql.localdomain GET /server-status?refresh=15 HTTP/1.1 7-0 31712 0/13/13 _ 0.00 15 0 0.0 0.06 0.06 localhost ol6-mysql.localdomain GET /server-status?refresh=15 HTTP/1.1 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
During periods of high activity, you can now monitor the status of the Apache server to see if your configuration needs adjusting.
For more information see:
- Apache Module mod_status
- Linux HTTP and FTP Server Configuration (RHCSA)
- Linux HTTP Server Configuration (RHCE)
- Apache : Reverse Proxy Configuration
Hope this helps. Regards Tim...