How to set apache server status using mod_status
How to set apache server status using mod_status
What is apache server status? Normally only server administrators would have access to this section, they would look at this specific page to lookup more information on their current server activity in an easily readable form.
The current information you can view from this page are:
- The number of worker processes serving requests currently active
- The number of idle worker processes
- The status of each worker process, which includes the number of requests that specific worker process has performed and the total number of bytes served by the worker ( only if extended status is enabled )
- A total number of accesses and byte count served by the web server ( only if extended status is enabled )
- The number of times 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 ( only if extended status is enabled )
- The current percentage CPU used by each worker process and in total by Apache ( only if extended status is enabled )
- The current hosts and requests being processed ( only if extended status is enabled )
An example of how it should look is below (the information has been altered of course, I couldn’t really leave the exact details):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
Apache server status for sv1.yourhowto.net Server Version: Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.0-fips DAV/2 mod_bwlimited/1.4 Apache Server Built: Nov 7 2013 23:24:18 Current Time: Sunday, 19-Jan-2014 17:53:04 EET Restart Time: Monday, 23-Dec-2013 23:13:53 EET Parent Server Generation: 89 Server uptime: 26 days 18 hours 39 minutes 11 seconds Total accesses: 32378541 - Total Traffic: 498.8 GB CPU Usage: u328.85 s19.43 cu532.31 cs0 - .0381% CPU load 14 requests/sec - 226.1 kB/second - 16.2 kB/request 11 requests currently being processed, 7 idle workers .___WKWK.K___K.KWKK_..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-89 - 0/0/2299815 . 67.90 13 13 0.0 0.00 36596.25 ::1 sv1.yourhowto.net OPTIONS * HTTP/1.0 1-89 268121 0/173/2268705 _ 16.47 9 311 0.0 3.04 36203.50 45.44.35.17 sv1.yourhowto.net POST /page-requests/page-example.php HTTP/1.1 2-89 263936 0/451/1388041 _ 42.15 4 301 0.0 5.30 21924.04 70.35.85.96 sv1.yourhowto.net POST /page-requests/page-example.php HTTP/1.1 3-89 264085 0/523/2236500 _ 48.79 5 309 0.0 7.92 35492.05 24.63.195.82 sv1.yourhowto.net POST /page-requests/page-example.php HTTP/1.1 4-89 268869 21/113/2192860 W 13.42 0 0 993.6 2.45 35288.67 12.12.5.174 sv1.yourhowto.net GET /page-requests/page-example.php HTTP/1.0 5-89 265864 5/363/2164890 K 32.09 2 23 42.3 6.05 35077.25 79.116.9.235 sv1.yourhowto.net GET /page-requests/page-example.php HTTP/1.0 6-89 266527 18/269/1235407 W 34.23 0 0 180.6 2.49 19599.28 170.213.85.170 sv1.yourhowto.net GET /page-requests/page-example.php HTTP/1.1 7-89 259892 36/744/2076196 K 62.91 1 19 279.1 9.48 33286.61 20.58.102.184 sv1.yourhowto.net GET /page-requests/page-example.php HTTP/1.1 |
How to enable mod_status page on apache web server
Enabling mod_status page is as simple as adding a few lines to your apache web server. The only thing you need to keep in mind, the extended status mode will normally use a bit more resources and should be enabled only if the server has enough resources or specifically needed.
We would need to first choose a location where we want to have server status enabled, by default, this is set to /server-status/ but it can be anything you really want.
1 2 3 4 5 6 7 |
<Location /server-status> SetHandler server-status Order Deny,Allow Deny from all # This is your public IP address Allow from 25.25.23.23 </Location> |
And that’s it for enabling server status. To enable the Extended status which by default is disabled, you only add to your web server configuration file:
1 |
ExtendedStatus On |
Another option which I found interesting is the SeeRequestTail, if the request file name has more than 63 characters it will only show the last 63 which is better in knowing what’s going on when you have too many requests hitting the server at one point and the url has more than 63 characters.
The same as enabling ExtendedStatus, you add the following line:
1 |
SeeRequestTail On |
That’s it for now, see you again in our next tutorial.