How to Monitor Nginx with Telegraf, InfluxDB, and Grafana: A Step‑by‑Step Guide
Learn how to enable Nginx's stub_status module, collect metrics with Telegraf, store them in InfluxDB, and visualize real‑time performance dashboards in Grafana, covering installation, configuration, and interpretation of key Nginx statistics for effective server monitoring.
After building an Nginx cluster, daily monitoring is essential.
Nginx monitoring can be done via the nginx-status endpoint. Integrating the data with existing monitoring systems is conveniently achieved with the stack Nginx + Telegraf + InfluxDB + Grafana, where Telegraf periodically collects the status, stores it in InfluxDB, and Grafana visualizes it.
Nginx enable nginx‑status module
If Nginx is compiled from source, add the stub status module during configuration: ./configure --with-http_stub_status_module Use ./configure --help to list available modules, then compile and install.
If Nginx is installed via apt-get install, check module support with: nginx -V Look for --with-http_stub_status_module in the output.
Modify the Nginx configuration to add a location for the status endpoint:
location /nginx-status {
allow 127.0.0.1; // allowed IP
deny all;
stub_status on;
access_log off;
}Reload Nginx and request /nginx-status to see output such as active connections, accepts, handled, requests, reading, writing, waiting, etc.
Telegraf installation and Nginx monitoring configuration
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 enable the InfluxDB output and add the nginx input plugin, then restart the Telegraf service.
Grafana integration for Nginx monitoring
In Grafana, add InfluxDB as a data source, then create a dashboard with queries such as:
Data source: InfluxDB
FROM: nginx
SELECT: field(accepts)
The resulting panels display real‑time Nginx metrics.
By combining Nginx, Telegraf, InfluxDB, and Grafana, you obtain a convenient and powerful monitoring solution for Nginx.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
