Nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. For more information visit nginx.org.
Even if the Nginx plugin is not configured, Monitoring will discover Nginx services running in your Cloud Platform project by:
- searching instance names for nginx
- checking for ports opened to 80 or 443 via firewall rules
The services discovered are displayed on the Nginx Services page in the Resources menu. After you install the monitoring agent and configure the Nginx plugin on your instances, Monitoring populates the Nginx Services page with inventory and metrics.
Configuring Monitoring to monitor Nginx
After you install the monitoring agent, use the following instructions to configure the Nginx plugin on your instances.
The Nginx plugin requires that you enable the status information handler in Nginx.
This can be done by downloading status.conf from the
GitHub configuration repository
and placing it in the Nginx configuration directory (normally
(cd /etc/nginx/conf.d/ && curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/nginx/conf.d/status.conf)
Alternatively, you can append the contents of
nginx.conf file, normally located in one of the following directories
on your VM instance:
After changing nginx configuration, restart Nginx by running:
sudo service nginx restart
Enabling the Nginx monitoring plugin
(cd /opt/stackdriver/collectd/etc/collectd.d/ && curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/nginx.conf)
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 Nginx plugin monitors the following metrics:
- Active Connections (count): The number of active connections currently attached to Nginx.
- Reading Connections (count): The number of reading connections currently attached to Nginx.
- Writing Connections (count): The number of writing connections currently attached to Nginx.
- Waiting Connections (count): The number of waiting connections currently attached to Nginx.
- Requests (count/s): The number of requests per second Nginx is servicing.