[[["易于理解","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,["# Nginx plugin\n\nNginx is a free, open-source, high-performance HTTP server and reverse proxy,\nas well as an IMAP/POP3 proxy server.\nFor more information visit [nginx.org](http://nginx.org/).\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 Nginx 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| nginx](/stackdriver/docs/solutions/agents/ops-agent/third-party/nginx).\n\nDiscovery\n---------\n\nEven if the Nginx plugin is not configured, Cloud Monitoring will discover\nNginx services running in your Cloud Platform project by:\n\n- Searching instance names for **nginx**\n- Checking for ports opened to **80** or **443** via firewall rules\n\nTo see the metrics for Nginx, 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 **Nginx** dashboard from the list.\n\nConfiguring Monitoring to monitor Nginx\n---------------------------------------\n\nAfter you [install the monitoring agent](/monitoring/agent/monitoring/installation), use\nthe following instructions to configure the Nginx plugin on your instances.\n\n### Prerequisites\n\nThe Nginx plugin requires that you enable the status information handler in\nNginx. This can be done by downloading [status.conf](https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/nginx/conf.d/status.conf)\nfrom the [GitHub configuration repository](https://github.com/Stackdriver/stackdriver-agent-service-configs)\nand placing it in the Nginx configuration directory (normally `/etc/nginx/conf.d/`): \n\n (cd /etc/nginx/conf.d/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/nginx/conf.d/status.conf)\n\nAlternatively, you can append the contents of\n[status.conf](https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/nginx/conf.d/status.conf)\nto your `nginx.conf` file, normally located in one of the following directories\non your VM instance:\n`/etc/nginx`, `/usr/local/nginx/conf`, or `/usr/local/etc/nginx`.\n| **Caution:** You should only expose the agent's endpoint to `localhost` through HTTP.\n\nReload the Nginx configuration by running: \n\n sudo service nginx reload\n\n### Enabling the Nginx monitoring plugin\n\nOn your VM instance, download [nginx.conf](https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/nginx.conf)\nfrom the [GitHub configuration repository](https://github.com/Stackdriver/stackdriver-agent-service-configs)\nand 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/nginx.conf)\n\nAfter adding the configuration file, restart the monitoring agent by running the following command: \n\n sudo service stackdriver-agent restart\n\nFor more information on the `collectd` `nginx` plugin, see\n[Plugin:nginx](https://collectd.org/wiki/index.php/Plugin:nginx).\n\nWhat is monitored\n-----------------\n\nThe full list of metrics the Nginx plugin monitors is at\n[Agent metrics: nginx](/monitoring/api/metrics_agent#agent-nginx)."]]