Monitoring Nginx with nginx‑status, Telegraf, InfluxDB, and Grafana
This guide explains how to enable the nginx‑status module, configure Nginx to expose metrics, collect them with Telegraf, store them in InfluxDB, and visualize the data in Grafana, providing a complete end‑to‑end monitoring solution for Nginx servers.
After building an Nginx cluster, the next step is to set up continuous monitoring of Nginx.
The simplest way to obtain Nginx metrics is to enable the nginx-status module (also known as stub_status ).
1. Enable nginx‑status
When compiling Nginx from source, include the module:
./configure --with-http_stub_status_moduleYou can view available modules with ./configure --help . If you installed Nginx via apt-get install , check support with:
nginx -VLook for --with-http_stub_status_module in the output.
Then add the following location block to the server configuration:
location /nginx-status {
allow 127.0.0.1; // allowed IP
deny all;
stub_status on;
access_log off;
}Reload Nginx and verify the endpoint (e.g., curl http://127.0.0.1/nginx-status ).
The status page shows fields such as active connections , server accepts handled requests , reading , writing , and waiting .
2. Install and configure Telegraf
Download and install Telegraf (example for RPM‑based systems):
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.4.3-1.x86_64.rpm
sudo yum localinstall telegraf-1.4.3-1.x86_64.rpmEdit telegraf.conf to add an InfluxDB output and enable the nginx input plugin, pointing to the nginx-status URL.
After saving the configuration, restart the Telegraf service.
3. Visualize with Grafana
In Grafana, add InfluxDB as a data source, select the nginx measurement, and create panels using fields such as accepts . The article shows example screenshots of the dashboard.
Finally, the author provides additional resources and promotional links, but the core technical content is the end‑to‑end setup for Nginx monitoring.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.