[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Apache plugin\n\nApache is a widely-used web server for a variety of operating systems.\nFor more information, visit\n\u003chttp://httpd.apache.org/\u003e.\n\nThis functionality is only available for agents running on Linux. It is\nnot available on Windows.\n| **Note:** You can now collect metrics from your Apache instance using the [Ops Agent](/stackdriver/docs/solutions/agents/ops-agent), the primary and preferred agent for collecting telemetry from your Compute Engine instances. For details, see [configuring the Ops Agent for\n| Apache](/stackdriver/docs/solutions/agents/ops-agent/third-party/apache).\n\nDiscovery\n---------\n\nEven if the Apache plugin is not configured, Cloud Monitoring discovers\nApache services running in your Cloud Platform project by:\n\n- Searching instance names for **apache**\n\n- Checking for ports opened to **80** or **443** via firewall rules\n\nTo see the metrics for Apache, do the following:\n\n1. In the Google Cloud console, go to the **Dashboards** page:\n\n [Go to **Dashboards**](https://console.cloud.google.com/monitoring/dashboards)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. Select the **Apache HTTP Server** dashboard from the list.\n\nConfiguring Monitoring to monitor Apache\n----------------------------------------\n\nAfter you [install the Monitoring\nagent](/monitoring/agent/monitoring/installation), use the following\ninstructions to configure the Apache plugin on your instances.\n\n### Prerequisite\n\nThe Apache plugin requires that you enable the `mod_status` plugin in Apache.\nMany Apache installations enable this plugin by default. To see if the plugin is\nenabled on your VM instance, run the following request: \n\n curl http://local-stackdriver-agent.stackdriver.com:80/server-status?auto\n\nIf the plugin is enabled, then the output includes lines similar to the\nfollowing: \n\n Total Accesses: 2\n Total kBytes: 1\n BusyWorkers: 1\n IdleWorkers: 4\n\nIf instead you get a `404 Not Found` page, then `mod_status` is not enabled.\n\nHere are several options to enable the `mod_status` plugin:\n\n- Download [status.conf](https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/httpd/conf.d/status.conf)\n and place it in the Apache configuration directory on your VM instance,\n typically in `/etc/httpd/conf.d/` or `/etc/apache2/conf.d`. For more\n information about enabling the `mod_status` plugin, refer to the\n [Apache 2.4](https://httpd.apache.org/docs/2.4/mod/mod_status.html#enable)\n or [Apache 2.2](https://httpd.apache.org/docs/2.2/mod/mod_status.html#enable)\n documentation:\n\n (cd /etc/httpd/conf.d/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/httpd/conf.d/status.conf)\n\n- Append the contents of [status.conf](https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/httpd/conf.d/status.conf)\n to your main Apache configuration file, normally located at either\n `/etc/httpd/conf/httpd.conf` or `/etc/apache2/apache2.conf` on your VM\n instance.\n\n | **Caution:** You should only expose the agent's endpoint to `localhost` through HTTP.\n\nReload the Apache configuration by running:\n\n- For Debian, Ubuntu, and SLES:\n\n sudo a2enmod mod_status\n sudo a2enmod mod_access_compat\n sudo service apache2 reload\n\n- Other Linux distributions:\n\n sudo service httpd reload\n\n### Enabling the Apache monitoring plugin\n\nTo enable the Apache monitoring plugin, complete the following steps:\n\n1. On your VM instance, download [apache.conf](https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/apache.conf)\n and place it in the directory `/etc/stackdriver/collectd.d/`:\n\n (cd /etc/stackdriver/collectd.d/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/apache.conf)\n\n If you're not using the default or Google Cloud Observability-provided Apache\n `mod_status` configuration, as **root** , edit `apache.conf` by following the\n instructions at the top of the file.\n2. Restart the monitoring agent:\n\n sudo service stackdriver-agent restart\n\nFor more information on the `collectd` `apache` plugin, see\n[Plugin:Apache](https://collectd.org/wiki/index.php/Plugin:Apache).\n\nWhat is monitored\n-----------------\n\nThe full list of metrics the Apache plugin monitors is at\n[Agent metrics: apache](/monitoring/api/metrics_agent#agent-apache)."]]