Apache Monitor

This agent monitor plugin records performance and usage data from an Apache server.

An agent monitor plugin is a component of the Scalyr Agent. To use a plugin, simply add it to the monitors section of the Scalyr Agent configuration file (/etc/scalyr/agent.json). For more information, see Agent Plugins.

Configuring Apache

To use this monitor, you will need to configure your Apache server to enable the status module. For details, see the Apache documentation.

First, verify that the module is enabled in your Apache server. On most Linux installations, you can use the following command:

ls /etc/apache2/mods-enabled

If you see status.conf and status.load present, the module is enabled. Otherwise, use the following command (again, for most Linux installations):

sudo /usr/sbin/a2enmod status

On some platforms, you may need to use different commands to enable the status module. Also, if Apache was compiled manually, the module may not be available. Consult the documentation for your particular platform. Here are some links:

Next, you must enable the status module, usually by updating the VirtualHost configuration section of your Apache server. On Linux, this is typically found in the /etc/apache2/sites-available directory, in the file that corresponds to your site.

Add the following to the VirtualHost section (between <VirtualHost> and </VirtualHost>):

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

This specifies that the status page should be served at http://<address>/server-status, and can't be accessed from other servers.

Once you make the configuration change, you will need to restart Apache. On most Linux systems, use the following command:

sudo service apache2 restart

To verify that the status module is working properly, you can view it manually. Execute this command on the server (substituting the appropriate port number as needed):

curl http://localhost:80/server-status

If you have any difficulty enabling the status module, drop us a line at support@scalyr.com.

Sample Configuration

Here is a typical configuration fragment:

monitors: [
      module: "scalyr_agent.builtin_monitors.apache_monitor",
      status_url: "http://localhost:80/server-status/?auto"

If your Apache server is running on a nonstandard port, replace 80 with the appropriate port number. For additional options, see Configuration Reference.

Configuration Reference

Option Usage
module Always scalyr_agent.builtin_monitors.apache_monitor
id Optional. Included in each log message generated by this monitor, as a field named instance. Allows you to distinguish between values recorded by different monitors. This is especially useful if you are running multiple Apache instances on a single server; you can monitor each instance with a separate apache_monitor record in the Scalyr Agent configuration.
status_url Specifies the URL — in particular, the port number — at which the Apache status module is served. The URL should end in /?auto to indicate the machine-readable version of the page should be returned.
source_address Optional (defaults to ''). The source IP address to use when fetching the server status.

Uploading the Apache access log

If you have not already done so, you should also configure the Scalyr Agent to upload the access log generated by Apache. Scalyr's Apache dashboard uses this log to generate many statistics.

For most Linux systems, the access log is saved in /var/log/apache2/access.log. To upload, edit the logs section of /etc/scalyr-agent-2/agent.json. Add the following entry:

logs: [

     path: "/var/log/apache2/access.log",
     attributes: {parser: "accessLog", serverType: "apache"}

Edit the path field as appropriate for your system setup.

Viewing Data

After adding this plugin to the agent configuration file, wait one minute for data to begin recording. Then click the Dashboards menu and select Apache. (The dashboard may not be listed until the agent begins sending Apache data.) You will see an overview of Apache data across all servers where you are running the Apache plugin. Use the ServerHost dropdown to show data for a specific server.

See Analyze Access Logs for more information about working with web access logs.

Log reference

Each event recorded by this plugin will have the following fields:

Field Meaning
monitor Always apache_monitor.
metric The metric name. See the metric tables for more information.
value The value of the metric.
instance The id value from the monitor configuration.

Metric reference

The table below describes the metrics recorded by the Apache monitor.

Metric Description
apache.connections.active The number of connections that are being handled asynchronously (not using workers) currently open on the server.
apache.connections.writing The number of connections that are being handled asynchronously (not using workers) that are currently writing response data.
apache.connections.idle The number of connections that are being handled asynchronously (not using workers) that are currently idle / sending keepalives.
apache.connections.closing The number of connections that are being handled asynchronously (not using workers) that are currently closing.
apache.workers.active How many workers are currently active. Each worker is a process handling an incoming request.
apache.workers.idle How many of the workers are currently idle. Each worker is a process that can handle an incoming request.