Skip to content

Apache Httpd

Apache Httpd Monitoring

Apache Httpd is a well known web-server mostly used as frontend or for PHP web applications.

Get metrics from Apache in real time, graph them and correlate them with other relevant monitors:

  • Visualize your web server performance,
  • Correlate the performance of Apache with the rest of your applications.

Supported versions

Httpd 2.2.xx and 2.4.xx with mod_status enabled are supported.

Setup

The mod_status module must be enabled to collect httpd monitoring metrics. Edit httpd.conf file and include the commented out line:

LoadModule status_module modules/mod_status.so

Enabling extended statistics is highly recommended. Edit the ExtendedStatus setting in httpd.conf configuration file.

Restrict Access

Prior to version 2.4, to restrict access to the status report to machines on the company.com domain, edit httpd.conf configuration file and add:

<Location /server-status> 
    SetHandler server-status 
    Order Deny,Allow 
    Deny from all 
    Allow from .company.com 
</Location>

From version 2.4 and onward you should use the Require command instead:

<Location /server-status>
   SetHandler server-status
   Require all denied
   Require ip 192.168.190 192.168.160.11
   Require host company.com 
</Location>

Custom metrics

The Apache Httpd monitor supports querying custom monitoring metrics. To monitor a server other than an Apache Httpd, expose a page containing the monitoring metrics in the following format:

nameCounter1: 10 
nameCounter2: -23.567 
nameCounter2: +17.33 
...

Configuration

Apache Httpd Wizard

The Httpd monitor requires the status page URL. Optional credentials can be provided when the page is protected by basic authentication. The status URL should be similar to:

http://{hostname}:{port}/server-status

Don't specify any query parameter in the configured url.

Monitored Counters

When extended statistics are on (ExtendedStatus setting in the httpd.conf file set to On), the collected metrics are:

  • All:

    • Total Accesses: total requests since server startup,
    • Total KBytes: total kilobytes since server startup,
    • CPU Load: cpu load since server startup,
    • Uptime: server uptime in seconds,
    • ReqPerSec: average requests per second since server startup,
    • BytesPerSec: average bytes per second since server startup,
    • BytesPerReq: average bytes per request since server startup,
    • IdleWorkers: available worker processes,
    • BusyWorkers: worker processes currently executing requests,
    • % BusyWorkers: percent of busy workers.

Other Monitored counters

The monitored counters are those following the name: value format and whose value is an integer or a decimal number.

Going Further

IdleWorkers

In case there are very few or none idle workers it means Apache is using all the processes it is allowed to use and new incoming requests have to wait for older requests to finish before they can be handled. In this case, increasing the maximum allowed processes in your configuration file might help with performance under certain circumstances. This is true if your system has reserves to handle additional apache processes.

Each of them will need memory, CPU time and disk I/O. If you don't have these reserves, increasing the MaxClients might be even counter productive, as more processes will have to fight for the resources and it might be that reducing the number of maximum clients will improve performance if you already hit some bottleneck.

Workers

Too many workers can result in poor performance: the CPU spends most of its time in context switches. Measure context switches on the machine running Httpd and make sure you don't have too many context switches (max 30k switches per CPU per second).