≡ Menu

Display Apache Server Status with mod_status

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)

{ 14 comments… add one }

  • Gokdeniz Karadag June 6, 2008, 5:24 pm

    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.

  • patrick July 21, 2008, 2:47 am

    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.

  • moh1 September 6, 2008, 1:28 am

    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.

  • SS Senthil Kumar September 24, 2009, 6:39 pm

    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

    • newbie March 6, 2012, 9:19 pm

      put a # in front Deny from all. restart httpd after should work.

  • RS March 17, 2010, 9:39 am

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

    • Pico March 22, 2011, 8:47 am

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

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

      • APCTL July 20, 2011, 10:15 am

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

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

      • Imtiaz December 24, 2014, 6:17 am

        I am getting error :
        $ /usr/bin/wget .quiet “http:/172.18.1.139/server-status”
        ksh: /usr/bin/wget: not found
        Please suggest.

  • William Imhoff March 9, 2012, 2:50 pm

    Thanks for posting this information, I am working on this project right now.

  • jay October 24, 2012, 4:19 am

    Hi
    I’m trying to enable apache server status in one of apache web server, In the httpd.conf file, I’m seeing the following entries in the conf file. I’m not getting apache server status for monitor number of request.

    Please help us to enable apache monitoring or any body has perl script to monitor the apache server? it will be really helpful.

    Thanks
    Jay

    #
    # Load config files from the config directory “/etc/httpd/conf.d”.
    #
    Include conf.d/*.conf

    ExtendedStatus On
    NameVirtualHost *:portno2

    ServerName servername1
    DocumentRoot imagespartlog/
    DirectoryIndex index.html index.jsp

    Options FollowSymLinks -Indexes
    Order deny,allow
    Allow from all

    SetHandler server-status
    Order deny,allow
    Deny from all
    # Allow from .example.com
    Allow from .domain.com
    Allow from x0.x0.0.0/255.255.0.0
    Allow from x1.x1.x1.x1
    Allow from x2. X2.0.0/255.255.0.0
    Allow from x3.x3.0.0/255.255.0.0
    Satisfy Any

    ErrorLog “Error log directory”

  • Kani March 21, 2013, 11:28 am

    Wondeful!!!

    Thanks to you and Apache!!!

  • Troubleshooter August 27, 2013, 7:08 pm

    Just in case this helps someone:

    In newer versions of Apache there is a default server-status config setting in conf/extra/httpd-info.conf which will override any server-status settings in
    httpd.conf

    That default config in conf/extra/httpd-info.conf is set to “Allow from .example.com” and will annihilate all fancy server-status changes you do in httpd.conf

    So if you are facing permission issues make sure you are editing the proper file!

  • Sanjay December 10, 2013, 1:42 pm

    How do I can get the server-status as xml response or json response? so that I can parse according to my need.

    Can you help me out to configure apache 2.2 server in order to get xml/json response.

    Thanks in advance.
    Sanjay.

Leave a Comment