Monitoring Performance, Status and Load with mod_status for Apache Web Server (HTTPD)

With the Apache Status module – mod_status – server administrators and developers can monitor a bunch of things like:

  • How well is the web server performing.
  • What is the server load in terms of resource consumption (CPU), requests being served, clients being handled, etc.
  • What is the uptime status.
  • Some of the current server configuration.


Once the module is enabled, all we need to do is add a Location block to the main server config (httpd.conf or apache2.conf) or a virtual host block, that would specify the URL endpoint where we would like to monitor our server status. The Location block must also specify the status module’s handler to handle incoming requests.

<Location "/server-status">
    SetHandler server-status
    Require all granted

Now when you visit you should see a page like this:

mod_status /server-status page

A bunch of details are dumped on the page like:

  • Number of busy workers serving requests and the number of idle workers.
  • Server configuration like version, MPM in use.
  • The time when server was started/restarted and its uptime (total running elapsed time).

If the ExtendedStatus directive is set to On then additional data is tracked for the entire server and at a per worker level as well for incoming requests and the clients sending those requests:

  • Status of each worker, the number of requests they have handled, total number of bytes they’ve processed.
  • Total number of requests served and bytes processed by the entire server.
  • Average number of requests processed per second, bytes transferred per second, bytes transferred per request, time taken per request.
  • CPU usage by all the workers combined and at an individual level as well.
  • Current requests being processed by different clients and served off different virtual hosts.

HTTPD ships with a sample status.conf that looks like this:

<IfModule mod_status.c>
        # Allow server status reports generated by mod_status,
        # with the URL of http://servername/server-status
        # Uncomment and change the "" to allow access from other hosts.

        <Location /server-status>
                SetHandler server-status
                Require local
                #Require ip

        # Keep track of extended status information for each request
        ExtendedStatus On

This sample/default config file may get automatically includes while enabling the module. If not you can do so manually and make changes as required.

Access Restriction

It is a good idea to restrict the access to this endpoint to a particular IP or host instead of using Require all granted.

Machine Readable Format

There’s a machine-readable version of the server dump as well that can be requested by adding ?auto to the end of the URL – It dumps the information in this format:
ServerVersion: Apache/2.4.41 (Ubuntu)
ServerMPM: event
Server Built: 2022-01-05T14:49:56
CurrentTime: Thursday, 24-Feb-2022 10:36:20 UTC
RestartTime: Thursday, 24-Feb-2022 09:59:48 UTC
ParentServerConfigGeneration: 1
ParentServerMPMGeneration: 0
ServerUptimeSeconds: 2192
ServerUptime: 36 minutes 32 seconds
Load1: 0.03
Load5: 0.10
Load15: 0.05
Total Accesses: 137
Total kBytes: 316
Total Duration: 97
CPUUser: .12
CPUSystem: .13
CPUChildrenUser: 0
CPUChildrenSystem: 0
CPULoad: .0114051
Uptime: 2192
ReqPerSec: .0625
BytesPerSec: 147.62
BytesPerReq: 2361.93
DurationPerReq: .708029
BusyWorkers: 1
IdleWorkers: 49
Processes: 2
Stopping: 0
BusyWorkers: 1
IdleWorkers: 49
ConnsTotal: 0
ConnsAsyncWriting: 0
ConnsAsyncKeepAlive: 0
ConnsAsyncClosing: 0
Scoreboard: ______________________________________W___________....................................................................................................

This output can then be used by scripts or some tools that can generate graphs or charts out of the data over a time period. A visual graph or chart based UI is easier to monitor. Some tools will also allow setting alerts for different metrics when they breach a certain level or threshold.

Practical Troubleshooting

In cases where your server ends up consuming a lot of system resources that you can obviously monitor via tools like top or htop, you can use mod_status output to find the culprit request and client details. For this you’ll need to ensure that ExtendedStatus is On.

You can easily pick the process IDs from your top or htop list for a particular Apache worker and then search for that pid in the server status output to locate the clients and/or requests causing load problems.

Auto Refresh

If your browser supports page refreshes via the Refresh HTTP header, then you can add the ?refresh=N query param to the URL to refresh every N seconds as well. For instance will make the browser refresh the page every 5 seconds.

Leave a Reply

Your email address will not be published. Required fields are marked *