Apache Plugin

Apache is a widely-used web server for a variety of operating systems. For more information visit http://httpd.apache.org/.

Discovery

Even if the Apache plugin is not configured, Stackdriver Monitoring will discover Apache services running in your Cloud Platform project by:

  • searching instance names for apache
  • checking for ports opened to 80 or 443 via firewall rules

The services discovered are displayed on the Apache Services page in the Resources menu. After you install the monitoring agent and configure the Apache plugin on your instances, Stackdriver Monitoring populates the Apache Services page with inventory and metrics.

Configuring Stackdriver Monitoring to monitor Apache

After you install the monitoring agent, use the following instructions to configure the Apache plugin on your instances.

Prerequisites

The Apache plugin requires the mod_status plugin to be enabled in Apache. Many Apache installations come with the mod_status plugin enabled by default. This can be checked by running curl http://localhost:80/server-status?auto, which should give you some text starting with:

localhost
ServerVersion: Apache/2.x.xx...

If instead you get a 404 Not Found page, mod_status is not enabled.

For Apache installations where the mod_status plugin is not enabled, you would need to enable it. This can be done by downloading status.conf from the GitHub configuration repository and placing it in the Apache configuration directory on your VM instance (normally /etc/httpd/conf.d/):

(cd /etc/httpd/conf.d/ && curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/httpd/conf.d/status.conf)

Alternatively, you can append the contents of status.conf to your main Apache configuration file, normally located at either /etc/httpd/conf/httpd.conf or /etc/apache2/apache2.conf on your VM instance.

After changing apache configuration, restart Apache by running:

  • Debian and Ubuntu:  sudo service apache2 restart
  • Other Linux distributions:  sudo service httpd restart

Enabling the Apache monitoring plugin

On your VM instance, download apache.conf from the GitHub configuration repository and place it in the directory /opt/stackdriver/collectd/etc/collectd.d/:

(cd /opt/stackdriver/collectd/etc/collectd.d/ && curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/apache.conf)

If you had to explicitly enable mod_status in Apache as suggested in the previous section, edit the downloaded configuration file and replace APACHE_HOST:APACHE_PORT with local-stackdriver-agent.stackdriver.com:80.

After adding the configuration file, restart the monitoring agent by running the following command:

sudo service stackdriver-agent restart

Information on other plugin configuration options can be found at collectd.org.

What is monitored

The Apache plugin monitors the following metrics:

  • Active Connections (count): The number of active connections currently attached to Apache.
  • Idle Workers (count): The number of idle workers currently attached to Apache.
  • Requests (count/s): The number of requests per second serviced by Apache.

Send feedback about...

Stackdriver Monitoring