Display Apache Server Status with mod_status

by Vivek Gite on June 6, 2008 · 7 comments

Q. How do I display Apache server status such as current server activity and performance under Red Hat Enterprise Linux / UNIX / BSD?

A. You can use regular Linux / UNIX commands such as lsof, netstat, top, vmstat and others to view apache server activity, status and performance from a shell prompt. However, I recommend mod_status because it provides good information about Apache server.

mod_status Apache module

There is also mod_status built into Apache web server to get server status from a web browser. With this module you can easily find out how well your server is preforming. All reports are generated in a html format. You can easily find out following type of information:

  1. Total number of worker serving requests
  2. Total number of of idle worker
  3. Find the status of each worker, the number of requests that worker has performed and the total number of bytes served by the worker
  4. Total number byte count served
  5. Other information such as CPU usage, number of requests per second,current hosts and requests being processed etc.

How do I configure mod_status to display Apache web server status?

Open your httpd.conf / apache2.conf file:
# vi httpd.conf
Fnd out (append line) that read as follows to allow access from 10.1.2.5 only:

<Location /server-status>
   SetHandler server-status
   Order Deny,Allow
   Deny from all
   Allow from 10.1.2.5
</Location>

You can also restrict access using a domain name:

<Location /server-status>
   SetHandler server-status
   Order Deny,Allow
   Deny from all
   Allow from w1.g2.dc3.helpdesk.nixcraft.com
</Location>

Save and close the file. Restart web server, enter:
# service httpd restart
Fire a webbrowser and type the url http://your-server-ip/server-status or http://your-corp.com/server-status

Sample Apache Server Status Report


(Fig.01: Apache mod_status module in action)

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 7 comments… read them below or add one }

1 Gokdeniz Karadag June 6, 2008

Hi,

An undocumented or obscurely documented feature,
appending “?notable” to the status url, like;
http://your-server-ip/server-status?notable
gives you a different output.

Reply

2 patrick July 21, 2008

I get an error when I run this command /usr/sbin/apachectl status

here is the error:

Unfortunately, your browser is not supported by Sitebuilder.
Please use Internet Explorer 5.5 or later, or Mozilla.

Reply

3 moh1 September 6, 2008

on my redhat server running apache2 not giving proper report.. it was running fine last week. suddenly stop now..

please help me out..?

Current Time: Saturday, 06-Sep-2008 11:22:28 EST
Restart Time: Saturday, 06-Sep-2008 11:09:25 EST
Parent Server Generation: 1
Server uptime: 13 minutes 2 seconds
9 requests currently being processed, 17 idle workers
____WW_.__.W.W__K.W_____.__WK.K_…………………………..
……………………………………………………….
……………………………………………………….
……………………………………………………….
……………………………………………………….
……………………………………………………….
……………………………………………………….
……………………………………………………….

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

PID Key:

25963 in state: _ , 25964 in state: _ , 25965 in state: _
25966 in state: _ , 25967 in state: W , 25968 in state: W
25969 in state: _ , 25971 in state: _ , 25972 in state: _
25974 in state: W , 25976 in state: W , 25977 in state: _
25978 in state: _ , 25979 in state: K , 25981 in state: W
25982 in state: _ , 25983 in state: _ , 26248 in state: _
26250 in state: _ , 26251 in state: _ , 26336 in state: _
26337 in state: _ , 26338 in state: W , 26339 in state: K
26343 in state: K , 26344 in state: _ ,

——————————————————————————–
To obtain a full report with current status information you need to use the ExtendedStatus On directive.

Reply

4 SS Senthil Kumar September 24, 2009

i did the change in httpd.conf and restarted. But getting

Forbidden
You don’t have permission to access /server-status on this server.

How to fix that? Please guide me.

Any help greatly appreciated

Reply

5 RS March 17, 2010

I have server-status working fine using http:/servername/server-status
How can I output this to a text file?

Reply

6 Pico March 22, 2011

You can use wget command to output to a file, try :

/usr/bin/wget –quiet -O – “http:/servername/server-status” > Output.txt

Reply

7 APCTL July 20, 2011

[wget ... -O - ... > Output.txt] ??

Whats wrong with:
[wget ... -O Output.txt ... ] ?

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 15 + 12 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: